[text] 111

Viewer

  1. #include <cs50.h>
  2. #include <stdio.h>
  3.  
  4. int main(void)
  5. {
  6.     // TODO: Prompt for start size
  7. int n = get_int("Enter the popuation:");
  8.     // TODO: Prompt for end size
  9. int endsize = get_int("Enter end size:");
  10. int m = 0;
  11.  
  12.     // TODO: Calculate number of years until we reach threshold
  13.  do
  14. {
  15.     n = (n + (n / 3) - (n / 4));
  16.         if
  17.         (n > endsize);
  18.  
  19.         else
  20.     m = ( m + 1 );
  21. }
  22.     while (n <= endsize);
  23.         printf ("%d\n",m);
  24.  
  25. }

Editor

You can edit this paste and save as new: