Welcome to our Community
Wanting to join the rest of our members? Feel free to sign up today.
Sign up

Search results

  1. Aromal

    Solved C++ Program to find the sum of digits of an integer number

    Try this code: #include <iostream> using namespace std; int main() { int n,rem,s=0; cout<<"Enter the digits :"; cin>>n; while(n>0) { rem=n%10; s=s+rem; n=n/10; } cout<<"Sum of digits = "<<s<<endl; return 0; } Your code didn't work because there was no ending line that is "endl" at line...