Oct 21 2007 09:54 AM 36529Views 6Ans Write a program to read a four digit integer and print the sum of its digits.Write a program that reads a floating point number and then displays the right-most digit of the integral part of the number. rishi Programming Interview Questions gaurav kumar jaiswal Aug 31st, 2014 Write a c++ program to the sum and product of digits of an integers karuna gaur Apr 15th, 2013 456 sum is 15Codeint sumDigits(int n) { int sum = 0; while( n > 0 ) { sum += (n % 10); // add last digit of n to sum n /= 10; // divide n by 10 to "chop off" the last digit } return sum; getch(); } Answer Question Select Best Answer
Oct 21 2007 09:54 AM 36529Views 6Ans Write a program to read a four digit integer and print the sum of its digits.Write a program that reads a floating point number and then displays the right-most digit of the integral part of the number. rishi Programming Interview Questions gaurav kumar jaiswal Aug 31st, 2014 Write a c++ program to the sum and product of digits of an integers karuna gaur Apr 15th, 2013 456 sum is 15Codeint sumDigits(int n) { int sum = 0; while( n > 0 ) { sum += (n % 10); // add last digit of n to sum n /= 10; // divide n by 10 to "chop off" the last digit } return sum; getch(); } Answer Question Select Best Answer
gaurav kumar jaiswal Aug 31st, 2014 Write a c++ program to the sum and product of digits of an integers
karuna gaur Apr 15th, 2013 456 sum is 15Codeint sumDigits(int n) { int sum = 0; while( n > 0 ) { sum += (n % 10); // add last digit of n to sum n /= 10; // divide n by 10 to "chop off" the last digit } return sum; getch(); }
Ans