I need help for my homework. [so important]
hello dear programmers,
i need help for my homework.
Question:
The rate of decay of a radioactive isotope is given in terms of its half-life H, the time lapse required for the isotope to decay to one-half of its original mass. The isotope cobalt-60 ( 60 Co) 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 60 Co remaining can be computed by using the following formula:
r = amount * 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.
__________
not C++ please C.
Example Code:
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);
}