05-24-2013, 05:07 AM
#include<stdio.h>
#include<stdlib.h>
int main(void){
float B2;
float B;
int E;
printf("Enter the base: ");
scanf("%f", &B);
printf("Enter the exponent: ");
scanf("%d", &E);
if (E==0 && B!=0){
printf("The result is: 1 ");
}
else if (E==0 && B==0){
printf("The result is: Indeterminate ");
}
B2=B;
while(E!=1){
E=E-1;
B=B*B2;
}
printf("The result is: %f",B);
getch();
}
#include<stdlib.h>
int main(void){
float B2;
float B;
int E;
printf("Enter the base: ");
scanf("%f", &B);
printf("Enter the exponent: ");
scanf("%d", &E);
if (E==0 && B!=0){
printf("The result is: 1 ");
}
else if (E==0 && B==0){
printf("The result is: Indeterminate ");
}
B2=B;
while(E!=1){
E=E-1;
B=B*B2;
}
printf("The result is: %f",B);
getch();
}