compute value of one number raised to another in c

 compute value of one number raised to another in c

 #include<stdio.h>

int main()

{

float x,power;

int y, i ;

printf("\n Enter two number :");

scanf("%f%f",&x<&y);

power =i=1;

while(i<=y)

{

power=power*x;

i++;

}

printf("%f to the power %d is %f\n",x,y,power);

retrun 0;

or

 //compute value of one number raised to another in c
 #include<stdio.h>
int main()
{
float x,power;
int y, i ;
printf("\n Enter two number :");
scanf("%f%f",&x,&y);
power =i=1;
while(i<=y)
{
power=power*x;
i++;
}
printf("%f to the power %d is %f\n",x,y,power);
return 0;
}

 



 

  related program

1.whether a character entered through the keyboard is a special symbol or not

2.calculate of simple interest for 3 sets of p,n and r..

3.Demonstrates the use of new and delete operators for dynamic allocation and de-allocation of memory of C++. 

4.calculation of factorial value of a number in c. 




Comments

Popular posts from this blog

class with array in c++ (memory allocatin & using array in classes)

paper of size A0 has dimensions 1189 mmx 841 mm .Each subsequent size A(n) is defined as A(n-1) cut in half parallel to its shorter sides .Thus paper of size A1 would have dimensions 841 mm X 594 mm .Write a program to calculate the print paper sizes A0,A1,A2,.........A8.

constructor with default arguments