. WAP to calculate a power b.
#include<stdio.h>
#include<conio.h>
void main()
{
int a, b, i;
long r=1;
printf("Enter number: ");
scanf("%d",&a);
printf("Enter its power: ");
scanf("%d",&b);
for(i=1;i<=b;i++)
{
r=a*a;
}
printf("%d Power %d is %ld",a, b, r);
getch();
}
Enter number: 2
Enter its power: 5
2 Power 5 is 32
Enter its power: 5
2 Power 5 is 32