write a
program in c to display the
n terms of square natural number and
their sum.
Answers
Answered by
1
Explanation:
#include <stdio.h>
void main()
{
int i,n,sum=0;
printf("Input the number of terms : ");
scanf("%d",&n);
printf("\nThe square natural upto %d terms are :",n);
for(i=1;i<=n;i++)
{
printf("%d ",i*i);
sum+=i*i;
}
printf("\nThe Sum of Square Natural Number upto %d terms = %d \n",n,sum);
}
Similar questions
Physics,
2 months ago
English,
2 months ago
Physics,
4 months ago
Business Studies,
10 months ago
World Languages,
10 months ago
Chemistry,
10 months ago