11 + n
Chat with our AI personalities
Call the unknown number n. From the problem statement (n + 3)2 - (n + 2)2 = 11. Expanding both squares yields n2 + 6 n + 9 - (n2 + 4n + 4) = 11, or 2 n + 5 = 11, 2n = 6, n = 3.
n = number n + 6 ======
void main () { int no1, sum, n; clrscr() sum = 0; n = 1; printf("\n enter the number to which sum is to be generated"); scanf("%d",&no1); while(n<=no1) { sum=sum+n; n=n+1 } printf("\n the sum of %d = %d, no1, sum"); getch (); }
class Sum_Of_Digits { public static void printSumandnoofdigits(int n) { int temp = n; int count = 0; int sum = 0; while ( n > 0 ) { sum = sum + n % 10; n = n / 10; count ++; } System.out.println("The number is..." + temp ); System.out.println("The sum of digits is..." + sum); System.out.println("The number of digits is..." + count); } }
(The assumes that "the number" in the question is not n, although if they are they same number, this is still true.) "If the sum of the digits of the number is divisible by n, then the number itself is divisible by n" is true if n is 3 or if n is 9.