Sunday, 27 November 2011

C++ Program For Find Sum Of Given Number


#include<iostream.h>
#include<conio.h>
void main()
 {
   clrscr();
   int m,n,s=0;
   cout<<"Enter the number";
   cin>>n;
   do{
       m=n%10;
  s=s+m;
  n=n%10;
}while(n!=0);
   cout<<"Total Sum="<<s;
   getch();
 }

No comments:

Post a Comment