# include <iostream.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;
}
long int pangkat (int x, int n)
{
if(n==1)
return (x);
else
return(x*pangkat (x,n-1));
}
output
menghitung x ^ y
x = 1
y = 2
1 ^ 2 = 1
0 Response to "contoh 36"
Post a Comment