ProAnswers.org

Write a C program to evaluate the series given in comments?

/x=1/1+104+1/9…1/n2/
/y=1/1+1/8+1/27…1/n3/

#include

#include 

#include 

void main() 

{ 

int i,n; 

float x=0, y=0; 

clrscr(); 

printf(“enter value of n:”); 

scanf(“%d”, &n); 

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

{ 

x=x+1(1/pow)i,2)); 

y=y+(1/pow(i,3)); 

} 

Printf(“value of x=%f”,x); 

printf(“

value fo y=%f”,y);

getche(); 

} 

Output: 

Enter value of n:2 

Value of x= 1.2500 

Value of y=1.12500