You are viewing a single comment's thread. Return to all comments →
int main() { int n,sum=0,rem; cout<<"\n Enter a no."; cin>>n; while(n>0) { rem=n%10; sum=sum+rem; n=n/10; } cout<<"sum is="< return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Input and Output
You are viewing a single comment's thread. Return to all comments →
int main() { int n,sum=0,rem; cout<<"\n Enter a no."; cin>>n; while(n>0) { rem=n%10; sum=sum+rem; n=n/10; } cout<<"sum is="< return 0; }