Filename | The Rank [ used function ] |
Permission | rw-r--r-- |
Author | pramana |
Date and Time | 11:08 pm |
Label | Alpro cases |
Action |
This time I share a program of the rank ... the rank program I use to make it function ...
the rank is one of the mathematical operations, which the rank comes from the multiplication ...
example: a the rank b = a times a times as many b
The following is the rank c + + program
#include<iostream.h>
#include<conio.h>
double pangkat(int a,int b)
{
int hasil,i;
if (b==0)
{ return hasil=0;}
else if (b==1)
{ return hasil=a;}
else
{hasil=a;
for (i=2;i<=b;i++)
hasil*=a;
return hasil;
}
}
main()
{
int x=1,y=0;
cout<<"Calculate the rank"<<endl;
cout<<"limit value : ";cin>>x;
cout<<"Rank value : ";cin>>y;
cout<<x<<" rank "<<y<<" = "<<pangkat(x,y);
getch();
}
#include<conio.h>
double pangkat(int a,int b)
{
int hasil,i;
if (b==0)
{ return hasil=0;}
else if (b==1)
{ return hasil=a;}
else
{hasil=a;
for (i=2;i<=b;i++)
hasil*=a;
return hasil;
}
}
main()
{
int x=1,y=0;
cout<<"Calculate the rank"<<endl;
cout<<"limit value : ";cin>>x;
cout<<"Rank value : ";cin>>y;
cout<<x<<" rank "<<y<<" = "<<pangkat(x,y);
getch();
}
LET'S LEARN GUYS :)
0 comments:
Post a Comment