Two numbers are entered through the keyboard. Write a program to find the value of one number raised to the power of another.
#include <stdio.h>
#include <conio.h>
void main ( )
{
int m, n, co = 1;
long pow = 1;
clrscr ( );
printf ("\n\t Enter a number for base value .........:"); scanf ("%d",&m);
printf ("\n\t Enter a number for power value .......:"); scanf ("%d",&n);
while ( co <= n )
{
pow = pow * m;
co ++;
}
printf ("\n\t %d to the power %d is %ld", m, n, pow);
getch ( );
}
Click here to contact us
No comments:
Post a Comment