You are on page 1of 1

// WAP to find out sum of digits of a number #include<iostream.h> #include<conio.

h> void main() { int x,sum,num,y; cout<<"\n Enter the number : "; cin>>num; sum=0; while(num>0) { x=num%10; y=x; sum=sum+y; num=num/10; } cout<<"\n sum of squares of digits of number is " <<sum; getch(); }

You might also like