I am trying to get this program to divide and add. it is suppose to add all the (1/limit*limit) up and give a sum. for some reason it gives me an out of 1.0000 every time. Does anybody have any advise or help they can give me..... here is my code....
Code:#include <stdio.h> int main (void) { int limit; float sum=0; int i; printf("enter your limit\n"); scanf("%d",&limit); printf("your limit is %d\n\n",limit); for(i=1;i<=limit;i++) { sum=(1/(i*i))+sum; } printf("your total:%f",sum); return 0; }