Math, asked by sarvesh5018, 4 months ago

write a program to compute and desplay the sum of the following series by taking n as Input. 1+2/1×2+1+2+3/1×2×3+1+2+3+4+............n/1×2×3×4×...........n

Answers

Answered by trilakshitha
3

Answer:

/*This program will print the sum of the square of all natural numbers from 1 to N.*/#include<stdio.h>

int main(){

int i,N;

unsigned long sum;

/*read value of N*/

printf("Enter the value of N: ");

scanf("%d",&N);

/*set sum by 0*/

sum=0;

/*calculate sum of the series*/

for(i=1;i<=N;i++)

sum= sum+ (i*i);

/*print the sum*/

printf("Sum of the series is: %ld\n",sum);

return 0;}

Step-by-step explanation:

Hi..

Hope it helps you...

Similar questions