write a program to read 10 integers. then add up the calues of each of the individual digits and print out the sum (use while loop)
1
Expert's answer
2012-08-30T09:18:22-0400
#include <iostream>
using namespace std;
int main() { int sum = 0; int number; cout<<"Enter 10 numbers: "; for (int i=0;i<10;i++) { & cin>>number; & while (number!=0) & { sum+=number%10; number/=10; & } } cout<<"Sum of all the digits: "<<sum<<endl; return 0; }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment