#include <stdio.h>
#include <conio.h>
int powercalc(int,int);
void main()
{
int n,p;
clrscr();
printf("Enter Number and Power: ");
scanf("%d %d",&n,&p);
printf("Result %d",powercalc(n,p));
getch();
}
int powercalc (int n,int p)
{
if(p==0) return 1;
if(p==1) return n;
return n* powercalc(n,(p-1));
}
#include <conio.h>
int powercalc(int,int);
void main()
{
int n,p;
clrscr();
printf("Enter Number and Power: ");
scanf("%d %d",&n,&p);
printf("Result %d",powercalc(n,p));
getch();
}
int powercalc (int n,int p)
{
if(p==0) return 1;
if(p==1) return n;
return n* powercalc(n,(p-1));
}
No comments:
Post a Comment