'Print an exponential
I'm creating a program that compares numbers with their respective exponents, and indicates which of the three is the smallest. The problem is that I wouldn't want it to perform the operation, for example:
Let's say the smallest number was $4^{8}$, so it would calculate that value, but I want it to just print "4^8" on the screen, or related things, but without doing that operation (in this case, it prints 65536).
int main()
{
int a, b, c, smaller, x, y, z, for_a, for_b, for_c;
printf("first value: ");
scanf("%d", &a);
printf("Second value: ");
scanf("%d", &b);
printf("Third value: ");
scanf("%d", &c);
printf("Value of x: ");
scanf("%d", &x);
printf("Value of y: ");
scanf("%d", &y);
printf("Value of z: ");
scanf("%d", &z);
for_a= pow(a, x);
for_b= pow(b, y);
for_c= pow(c, z);
if (for_a< for_b && for_a < for_c){
smaller= for_a;
}
else if (for_b < for_c){
smaller = for_b;
}
else {
smaller = for_c;
}
printf("Smaller= %d\n", smaller);
return 0;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
