Program to Find "a" to the power "b"
#include<stdio.h>
//declaration of function
int pro(int , int);
void main()
{
int a ,b,c ;
printf("enter the numbers :");
scanf("%d%d" , &a , &b);
c = pro(a,b);
printf("%d to the power %d is %d",a,b,c);
}
//definition of function which is finding a to the power b
int pro(int x,int y)
{
int c=1,d=1;
if(y==0)
printf("%d" ,1);
if(x==0)
printf("%d", 0);
if((x!=0&&y!=0))
{
while(c<=y)
{
d*=x;
++c;
}
}
return d;
}
If You Liked This Post Please Take a Time To Share This Post
Students do not have to worry about their Online Essay Writing Service anymore because our writers are here to provide any Research Writing Services.
ReplyDelete