RKS: Computer Science
Thursday, 1 September 2016
11C-PRACTICAL PROGRAM-6 SUM OF THE DIGITS
#include<iostream.h>
#include<conio.h>
void main()
{
int r,n,sum=0;
cout<<"Enter the number";
cin>>n;
do
{
r=n % 10;
sum=sum+r;
n=n/10;
}while(n !=0);
cout<<"\nsum of digits="<<sum;
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment