C program to find the sum of squares of first n natural numbers
March 7, 2020
Here is a simple C program to find the sum of squares of first n natural numbers using do-while looping construct –
main(){
int n, sum =0;
printf("\nInput any integer of your choice>>");
scanf("%d",&n);
nsave = n;
do{
sum += n*n;
n--;
}
while(n > 0);
printf("Sum of squares upto %d = %d \n", nsave, sum);
}