Rabu, 20 April 2011

Program Hasil Pemangkatan

0 komentar

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

Leave a Reply

Labels