Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BÀI 19:
- CODE 1:
- // BAI 19
- #include<conio.h>
- #include<stdio.h>
- main()
- {
- float i=1,x,s=0,mu=1,gt=1;
- printf("nhap x ");
- scanf("%f",&x);
- while(mu/gt>0.0001)
- {
- s=s+mu/gt;
- mu=mu*x;
- gt=gt*i;
- i++;
- }
- printf("s= %0.2f ",s);
- }
- CODE 2:
- #include"stdio.h"
- #include"conio.h"
- main()
- {
- int i;
- float emux,x,s=0,s1=1,s2=1,sx=0,c=0.00001;
- printf("\nPhuong trinh tinh e mu x");
- printf("\nXin hay nhap gia tri cua x: x=");
- scanf("%f",&x);
- for(i=1;;++i)
- {
- s1*=x;
- s2*=i;
- sx=s1/s2;
- if(sx<0&&sx>(-1*c))break;
- else if(sx>0&&sx<c)break;
- s+=sx;
- }
- emux=1+s;
- printf("\nGia tri cua e mu %6.4fla:%6.4f",x,emux);
- getch();
- }
- CODE 3:
- #include<conio.h>
- #include<stdio.h>
- int main()
- {
- float e=1,x,t;
- printf("nhap x= ");scanf("%f",&x);
- int a=1;
- t=x;
- while(t>=0.000001)
- {
- e=e+t;
- a=a+1;
- t=t*(x/a);
- }
- printf("e^%f= %f",x,e);
- getch();
- return 0;
- }
- CODE 4: PHIÊN BÃN CỦA THIỆN TOẠCH LÀ CÁI CHẮC.. ^^!
- #include <stdio.h>
- #include <conio.h>
- int main()
- {
- float c=0.0001,x, mu=1,s=0;
- int gt=1,i=1;
- printf("x=");
- scanf("%f",&x);
- while(mu/gt>c)
- {
- s=s+1.0*(mu/gt);
- mu=mu*x;
- gt=gt*i;
- i++;
- }
- printf("s: %4.6f",s);
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment