Programming Examples
Calculate the value of mx . Where ‘m’ is a mantissa and ‘x’ is an exponent
Write a program to enter mantissa and exponent. Calculate the value of mx . Where ‘m’ is a mantissa and ‘x’ is an exponent
Solution
#include<stdio.h>
void main()
{
int i,number,power;
long ans;
clrscr();
printf(“\n Enter Number :”);
scanf(“%d”,&number);
printf(“\n Enter Power :”);
scanf(“%d”,&power);
ans=1;
for(i=1;i<=power;i++)
ans*=number;
printf(“\n The Power of %d raised to %d is %ld\n”, number,
power,ans);
getch();
}
Output
OUTPUT:
Enter Number : 5
Enter Power : 3
The Power of 5 raised to 3 is 125.