4. (A) Write a program to find the sum of squares of digits of a number.

4. (A)  Write a program to find the sum of squares of digits of a number.
Write a program to find the sum of squares of digits of a number.


#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,sum = 0;
clrscr();
printf("Enter the number:: ");
scanf("%d",&n);
for(i=1;i<=n;i++)
sum += i * i;
printf("sum :: %d",sum);
getch();
}

















#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,sum = 0;
clrscr();
printf("Enter the number:: ");
scanf("%d",&n);
for(i=1;i<=n;i++)
sum += i * i;
printf("sum :: %d",sum);
getch();
}
4. (A) Write a program to find the sum of squares of digits of a number. 4. (A)  Write a program to find the sum of squares of digits of a number. Reviewed by admin on December 23, 2019 Rating: 5

No comments:

Powered by Blogger.