frain8

Untitled

Nov 19th, 2019
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.60 KB | None | 0 0
  1. /* Dasproc C - 2019
  2. William Handi Wijaya
  3. 0087
  4.  
  5. Menghitung perubahan pada cobalt
  6. */
  7.  
  8. #include <stdio.h>
  9. #include <math.h>
  10. #define HALF_LIFE 5.272
  11. int main()
  12. {
  13.     int i; //loop variable
  14.     double amount; // input - initial amount of cobalt
  15.     //get the initial amount
  16.     printf("\nEnter the initial amount of Cobalt - ");
  17.     scanf("%lf", &amount);
  18.     //printing the results
  19.     printf("\nYear %8c Amount Remains", ' ');
  20.         //printing the each year remains
  21.     for (i = 1; i <= 5; i++)
  22.     {
  23.         amount -= (amount * exp(-0.0693 * (i / HALF_LIFE)));
  24.         printf("\n %d %10c %.4f g", i, ' ', amount);
  25.     }
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment