C program to addition of square of n numbers.

Question:

Write C program to find out:

 


Source Code:

#include<stdio.h> void main() { int num,iter,sum=0; printf("Enter value of n:\n"); scanf("%d",&num); for(iter=1;iter<=num;iter++) { sum=sum+(iter*iter); } printf("Sum of series is:%d",sum); }

Output:

Enter value of n: 6 Sum of series is:91

Comments

Popular posts from this blog

Introduction to Python.

Decision Making Statement.