#include <iostream.h>
#include <conio.h>
long int pangkat (int x, int n);
void main()
{
int x,y;
cout<< "Menghitung x ^ y"<<endl;
cout<< " x : ";
cin>> x;
cout<< " y : ";
cin>> y;
cout<< x <<"^"<<y<<"="<< pangkat (x,y)<<endl;
getch();
}
long int pangkat (int x, int n)
{
if (n==1)
return (x);
else
return (x*pangkat (x, n-1));
}
Tuesday 26 November 2013
Jawaban Output Fungsi2.cpp
Subscribe to:
Post Comments (Atom)
0 Komentar:
Post a Comment