Assaalamualaiku. teman - teman postingan hari ini, saya akan membahas tentang flowchar program sin x fungtion. teman - teman silahkan dipahami dan dicermati yaa pada program dibawah ini.
1. reptor.
2. dev.
#include <iostream>
#include <string>
using namespace std;
int main()
{
string raptor_prompt_variable_zzyz;
int p, batas, x, hasil,fungsi2;
int j=3;
int hasil2=1;
int fungsi=1;
int i=1;
int o=1;
cout << "fungsi sin(x)=x/1!-(x^3)/3!+...." << endl; raptor_prompt_variable_zzyz ="masukkan batas faktorial fungsi sin(x)";
cout << raptor_prompt_variable_zzyz << endl;
cin >> batas;
raptor_prompt_variable_zzyz ="masukkan nilai x";
cout << raptor_prompt_variable_zzyz << endl;
cin >> x;
i =1;
hasil =1;
hasil2 =1;
j =3;
o =1;
p =1;
while (!(i>batas))
{
while (!(o>i))
{
hasil =hasil*o;
o =o+1;
}
while (!(p>j))
{
hasil2 =hasil2*p;
p =p+1;
}
fungsi =(x*i)/hasil;
fungsi2 =((x*j)/hasil2)*(-1);
hasil =fungsi+fungsi2;
i =i+4;
j =j+4;
}
cout << hasil << endl;
return 0;
}
1. reptor.
2. dev.
#include <iostream>
#include <string>
using namespace std;
int main()
{
string raptor_prompt_variable_zzyz;
int p, batas, x, hasil,fungsi2;
int j=3;
int hasil2=1;
int fungsi=1;
int i=1;
int o=1;
cout << "fungsi sin(x)=x/1!-(x^3)/3!+...." << endl; raptor_prompt_variable_zzyz ="masukkan batas faktorial fungsi sin(x)";
cout << raptor_prompt_variable_zzyz << endl;
cin >> batas;
raptor_prompt_variable_zzyz ="masukkan nilai x";
cout << raptor_prompt_variable_zzyz << endl;
cin >> x;
i =1;
hasil =1;
hasil2 =1;
j =3;
o =1;
p =1;
while (!(i>batas))
{
while (!(o>i))
{
hasil =hasil*o;
o =o+1;
}
while (!(p>j))
{
hasil2 =hasil2*p;
p =p+1;
}
fungsi =(x*i)/hasil;
fungsi2 =((x*j)/hasil2)*(-1);
hasil =fungsi+fungsi2;
i =i+4;
j =j+4;
}
cout << hasil << endl;
return 0;
}
Comments
Post a Comment