skip to main |
skip to sidebar
###
Calculation of One Number Raised to Another.

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>**main()**{****int** num1,

index,

result,

temp; /* num2=index*/printf("Enter the number:");scanf ("%d",

&num1);printf("Enter the index:");scanf("%d",

&index);result=1;temp=1;**while**(temp<=index)**{**result = result*num1;temp++;**}**printf("%d raised to %d is: %d ",

num1,

index,

result);**}**

The file can be found at:

Download File.

## 3 comments:

#include

main()

{

int i,n,res;

printf("Enter the Num:");

scanf("%d", &n);

printf("Enter the index:");

scanf("%d", &i);

res=pow(n,i);

printf("The number " %d " raised to the power " %d "is "%d "==" %d, n,i,res );

}

}

thax ramg,u made program simple to understand

#include

main()

{

int a,b,c,d;

printf("Enter two numbers seperated by space: ");

scanf("%d%d",&a,&b);

c = pow(a,b);

printf("The value of, %d raised to the power of %d is %d",a,b,c);

}

Post a Comment