Selasa, 19 April 2011

Program Pemangkatan

0 komentar

#include <iostream.h>
#include <math.h>
#include <conio.h>
float pangkat(int x, int y)
{     return(exp(y*log(x)));  }
main() {
     float hasil;
     int a, b;
     cout << "Menghitung hasil perpangkatan\n";
     cout << "Tulis sebuah bilangan : "; cin >> a;
     cout << "Mau dipangkat berapa  : "; cin >> b;
     hasil = pangkat(a,b);
     cout << a << " pangkat " << b << " = "  << hasil;
     getch();
     return 0;  
}
Hasil:

Leave a Reply

Labels