#include <stdio.h> #include <math.h> int main() { double a = 1000, t = 360, one
ID: 3631319 • Letter: #
Question
#include <stdio.h>
#include <math.h>
int main()
{
double a = 1000, t = 360,> double i = .05;
double product, sum;
int j,> double exp = 1.00f;
double inverse = 0.00f;
product = a * i;
printf("product = %f ", product);
sum = one + i;
printf("sum = %f ", sum);
for(j = 1; j <= t; j++)
{
exp = exp * sum;
}
printf("%f raised to the power of %f is %f ", sum, t, exp);
inverse = one/exp;
printf("%f ", inverse);
return 0;
}
Why is inverse assigned the value of 0.000000
Explanation / Answer
#include <stdio.h>
#include <math.h>
int main()
{
double a = 1000, t = 360,> double i = .05;
double product, sum;
int j,> double exp = 1.00f;
double inverse = 0.00f;
product = a * i;
printf("product = %f ", product);
sum = one + i;
printf("sum = %f ", sum);
for(j = 1; j <= t; j++)
{
exp = exp * sum;
}
printf("%f raised to the power of %f is %f ", sum, t, exp);
inverse =one/exp;
// 1 / large number automatically assigns 0.0000
// u are dividing with large numbers.
printf("%f ", inverse);
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.