Question:
The rate of decay of a radioactive isotope is given in terms of its half time H, the time lapse required for the isotope to decay to one-half of its original mass.The isotope cobalt-60 has a half-life of 5.272 years. Compute and print in table form the amount of this isotope that remains after each year for 5 years, given the initial presence of an amount in grams. the value of amount should be provided interactively. the amount of cobalt-60 remaining can be computed by using the following formula: r=amount X C^(y/H) where amount is the initial amount in grams, c is expressed as e^-0.693 (e=2.71828), y is the number of years elapsed, and H is the half-life of the isotope in years.
Code:
#include <stdio.h>
#include <math.h>
int
main(void)
{
int year;
double cobalt_initial;
printf("Please enter the initial amount of Cobalt> ");
scanf("%lf", &cobalt_initial);
printf(" Year Amount Total\n");
for (year = 0; year <= 5; year += 1){
cobalt_initial = cobalt_initial - cobalt_initial * exp((-.0693)*(year/(5.272)));
printf("%6c%d%8c%.2f\n", ' ', year, ' ', cobalt_initial);
}
return(0);
}
the program, instead of making a table for every year does this:
Please enter the initial amount of Cobalt> 200
Year Amount Total
6 0.00
Please help me identify the problem and tell me what to do. Thank you!