Program Pangkat


berikut merupakan contoh program menentukan bilangan pangkat,
monggo di pelajari dan di pahami,,,,,, semoga bermanfaat.
#dilanrang covas
#include <iostream>

using namespace std;

int pangkat(int a, int n){
    int k,hasil;
    hasil=1;
    for(k=1; k<=n; k++){
             hasil=hasil*a;
             }
    return hasil;
    }

int main(){
    int a,n;
    cout<<"Masukkan bilangan bulat tak negatif = ";
    cin>>a;
    cout<<"Masukkan pangkat = ";
    cin>>n;
    cout<<"Hasil perpangkatan = "<<pangkat(a,n);
    cout<<endl;
    system("PAUSE");
    return 0;
    }
Posted in c++

komentar

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

calender lalu
April 2013
T W T F S S M
« Mar    
 1
2345678
9101112131415
16171819202122
23242526272829
30  

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

Information
081-917- 166-???
Lunch: 11am - 2pm
Dinner: M-Th 5pm - 11pm, Fri-Sat:5pm - 1am
%d bloggers like this: