Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - C language-enter an integer and find the sum of the squares of its digits.
C language-enter an integer and find the sum of the squares of its digits.
Master ()

{

int x,n,s=0,y,z;

scanf("%d%d ",& ampn & amp; y); //Enter an integer and integer digits.

for(z = 1; z & lt= y; z++)

{

x = n % 10;

n = n/ 10;

s+= x * x;

}

printf(" %d ",s);

}

This program requires you to enter digits. Of course, the number of digits can also be calculated by the number entered. Think for yourself. The same scenery on the second floor, you can't just think about the results, if you can't find the number.

E-mail address Xiao 8858898 @ 163.com

I'll call you back.