===========================================================================
CODING
#include<conio.h>
#include<iostream.h>
#include<math.h>
void main()
{
clrscr();
int b,c,d,e,f,q;
long a;
cout<<"Enter any five digit number:- ";
cin>>a;
b=a%10;
a=a/10;
c=a%10;
a=a/10;
d=a%10;
a=a/10;
e=a%10;
a=a/10;
f=a%10;
a=a/10;
q=b+c+d+e+f;
cout<<"\n The sum of all the digits of the 5 digit number is:- "<<q;
getch();
}
CODING
#include<conio.h>
#include<iostream.h>
#include<math.h>
void main()
{
clrscr();
int b,c,d,e,f,q;
long a;
cout<<"Enter any five digit number:- ";
cin>>a;
b=a%10;
a=a/10;
c=a%10;
a=a/10;
d=a%10;
a=a/10;
e=a%10;
a=a/10;
f=a%10;
a=a/10;
q=b+c+d+e+f;
cout<<"\n The sum of all the digits of the 5 digit number is:- "<<q;
getch();
}
===========================================================================
No comments:
Post a Comment