Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- int main()
- {
- int n=1;
- float e;
- printf ("enter any positive number e=\n");
- scanf("%f", &e);
- float sum=0;
- do{
- sum=sum+1.0/n;
- n++;
- }while(sum<e);
- printf("%d\n",n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement