#include<iostream.h>
#include<conio.h>
void main()
{
                int num,sum=0,remainder;
                clrscr();
                cout<<"Enter A Number : - ";
                cin>>num;
                do
                                {
                                remainder=num%10;
                                sum=sum+remainder;
                                num=num/10;
                                }while(num>0);
                cout<<"The Sum Is :- "<<sum;
                getch();
}

37.PNG

Advertisements