Computer Science, asked by srinivasulu22, 4 months ago

write a
program in c to display the
n terms of square natural number and
their sum.

Answers

Answered by anuragojha47
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