/*Serial No.77 [swami46.cpp]*/
#include<stdio.h>
#include<conio.h>
int power(int b,int e);
void main()
{
int b,e,b1,res,e1;
printf("Enter base:=");
scanf("%d",&b);
printf("Enter power:=");
scanf("%d",&e);
b1=b;
e1=e;
res=power(b,e);
printf("%d^%d:=%d",b1,e1,res);
getch();
}
int power(int b,int e)
{
int b1=b;
while(e!=1)
{
b=b1*b;
e--;
}
return(b);
}
#include<stdio.h>
#include<conio.h>
int power(int b,int e);
void main()
{
int b,e,b1,res,e1;
printf("Enter base:=");
scanf("%d",&b);
printf("Enter power:=");
scanf("%d",&e);
b1=b;
e1=e;
res=power(b,e);
printf("%d^%d:=%d",b1,e1,res);
getch();
}
int power(int b,int e)
{
int b1=b;
while(e!=1)
{
b=b1*b;
e--;
}
return(b);
}
No comments:
Post a Comment
If you have any doubt, feel free to ask...