Menghitung sin, cos dan tan
2. Identifikasi
Input : x, pi=3.14;
Output : sin, cos, tan
3. Algoritmanya
Deklarasi
int : x, pi=3.14
Deskripsi
sin_ = sin (x*pi/180);
cos_ = cos(x*pi/180);
tan_ = tan(x*pi/180);
cos_ = cos(x*pi/180);
tan_ = tan(x*pi/180);
C++ nya
#include <cstdlib>
#include <iostream>
#include <conio.h>
#include<math.h>
using namespace std;
int main(int argc, char *argv[])
{
double x,sin_,cos_,tan_;
float pi=3.14;
cout<<"masukkan nilai =";cin>>x;
sin_ = sin (x*pi/180);
cos_ = cos(x*pi/180);
tan_ = tan(x*pi/180);
cout<<"sin = "<<sin_<<endl;
cout<<"cos = "<<cos_<<endl;
cout<<"tan = "<<tan_<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
#include <iostream>
#include <conio.h>
#include<math.h>
using namespace std;
int main(int argc, char *argv[])
{
double x,sin_,cos_,tan_;
float pi=3.14;
cout<<"masukkan nilai =";cin>>x;
sin_ = sin (x*pi/180);
cos_ = cos(x*pi/180);
tan_ = tan(x*pi/180);
cout<<"sin = "<<sin_<<endl;
cout<<"cos = "<<cos_<<endl;
cout<<"tan = "<<tan_<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
pseudocode nya bagaimana kak?
BalasHapus