4. (A) 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.
Reviewed by admin
on
December 23, 2019
Rating:
Reviewed by admin
on
December 23, 2019
Rating:

No comments: