Friday, 3 July 2015

Sums of Powers of Numbers

In this program, you are given an input N, which is a positive integer less than or equal to 40. Write a program to find the sums of fourth powers of the first N numbers.

Sample Input2

Sample Output
17
/*CODE*/
#include<stdio.h>
int main()
{
int N,i,sum=0;
scanf("%d",&N);
if(N>40)
return 0;
for(i=1;i<=N;i++)
{
sum=sum+(i*i*i*i);
}
printf("%d",sum);
return 0;
}

No comments:

Post a Comment