print the total of 1/2 + 2/3+......+9/10. ...

/* print the total of 1/2 + 2/3+......+9/10. */

#include
#include
void main()
{
float i=1,j=2;
float tot=0;
clrscr();
while(i<10)
{
tot=tot+(i/j);
printf("\n%f",i/j);
i++;
j++;
}
printf("\nsum is %f",tot);
getch();
}

0 comments:

Post a Comment