SCREENSHOTS
To Download The FILES
------ClickHere-------
CODE
Starts from here ----------->>
#include<iostream.h>
#include<conio.h>
int sod(int);
void main()
{ int n;
clrscr();
cout<<"\nEnter: ";
cin>>n;
cout<<"\nSum of the digits of "<<n<<" is "<<sod(n)<<".";
getch();
}
int sod(int d)
{ int x=0,i;
while(d>0)
{ i=d%10;
x+=i;
d=d/10;
}
return x;
}
#include<conio.h>
int sod(int);
void main()
{ int n;
clrscr();
cout<<"\nEnter: ";
cin>>n;
cout<<"\nSum of the digits of "<<n<<" is "<<sod(n)<<".";
getch();
}
int sod(int d)
{ int x=0,i;
while(d>0)
{ i=d%10;
x+=i;
d=d/10;
}
return x;
}
<<------------Ends Here
No comments:
Post a Comment