I am unable to find the exact solution of 2 raise to the power 32 in the following program. I am using cygwin terminal.
#include <stdio.h>
main()
{
int base, expo;
long long value = 1;
printf("Enter base number and exponent respectively");
scanf("%d%d", &base, &expo);
while (expo != 0)
{
value *= base;
--expo;
}
printf("Answer = %ll ", value);
return 0;
}
I would want some help in knowing what datatype would be appropriate for storing the value of 2 raise to 32.
2
32
is equal to 4294967296
. This can be easily resented by long long
type. Use %lld
specifier.