Sunday, 2 October 2011

Power of any number in c

/* Program to print the power of any number in c language */



#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,i=0,t=1;
clrscr();
printf("Enter the number : ");
scanf("%d",&a);
printf("Enter the power of number : ");
scanf("%d",&b);
for(i=0;i<b;i++)
t=t*a;
printf("The %d to the power %d is : %d",a,b,t);
getch();
}

No comments:

Post a Comment