constitutive numbers

South Africa
November 27, 2006 5:12am CST
You will be given two ints A and B. Return the number of constitutive numbers between A and B, inclusive. Definition Class: ConstitutiveNumbers Method: count Parameters: int, int Returns: int Method signature: int count(int A, int B) (be sure your method is public) Constraints - A will be between 1 and 1,000,000,000, inclusive. - B will be between A and A + 1000, inclusive. Examples 0) 1 15 Returns: 6 The first 6 constitutive numbers are: 6 = 1 + 2 + 3 9 = 2 + 3 + 4 10 = 1 + 2 + 3 + 4 12 = 3 + 4 + 5 14 = 2 + 3 + 4 + 5 15 = 4 + 5 + 6 1) 1 101 Returns: 69 2) 1000 1030 Returns: 26 3) 7245723 7246428 Returns: 657 4) 1000000000 1000001000 Returns: 952
No responses