Friday 24 June 2016

C programme to print the sum of 1+1/sqr(2)+1/sqr(3)+....


C programme to print the sum of 1+1/sqr(2)+1/sqr(3)+....
 
#include<stdio.h>
#include<conio.h>  
#include<math.h> 
int main() 
{  
int term,i=1;  
float sqr=0.0;  
printf("Enter number of terms you want");  
scanf("%d",&term);  
while(i<=term)  
 { 
   sqr=sqr+(float)1/pow(i,2);   
   i++;  
 }   
printf("\nThe ans is %f",sqr); 

}

0 comments:

Post a Comment

Have A Wonderful Day !

--------------------------------------------------------------------

Word Of The Day | Learn And Use A New Word Everyday!

--------------------------------------------------------------------

"Insidious"

Working or spreading in a hidden and usually injurious way

"glaucoma is an insidious disease"

Copyright © 2016 Engineers Burger - All Rights Reserved. Digital Craftmanship - Nikhil Jha and Jay Akbari.
MyBloggerLab.com