asmanhaikal

Contoh script program dengan menggunakan file header math.h

Dec 31st, 2020 (edited)
1,366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream.h>
  2. #include <conio.h>
  3. #include <math.h>
  4. main()
  5. {
  6.  int a = 45;
  7.  int b = 4;
  8.  int c = 2;
  9.  float ipangkat, iakar, isin ,icos, itan;
  10.  
  11.  iakar = sqrt(b);
  12.  cout<<"Akar dari "<<b<<" adalah"<<iakar<<endl;
  13.  
  14.  ipangkat = pow(b,c);
  15.  cout<<b<<" pangkat "<<c<<" adalah"<<ipangkat<<endl;
  16.  
  17.  isin = sin(a);
  18.  cout<<"sin sudut "<<a<<" derajat adalah"<<isin<<endl;
  19.  
  20.  icos = cos(a);
  21.  cout<<"cos sudut "<<a<<" derajat adalah"<<icos<<endl;
  22.  
  23.  itan = tan(a);
  24.  cout<<"tan sudut "<<a<<" derajat adalah"<<itan;
  25.  getch();
  26. }
Add Comment
Please, Sign In to add comment