0
#include <cs50.h>
#include <stdio.h>


int main(void) 

{
    
    // TODO: prompt for the start size 
   
    int n; 
    do
    { 
        n = get_int("start size: "); 
    }
    while (n < 9);
    
    // TODO: prompt for the end size 
    
    int x;
    do
    {
        x = get_int("End size: ");
    }
    while (x < n);
    // TODO: Calculate number of years untill we raech thershold 
    
    int y = 0;
    while (n < x)
    {
        n = n + (n / 3) - (n / 4);
        
        y++;
    }
     
    
    // TODO: print number of years 
    {
        printf("Years:  %i\n", y); 
        
    }
}
1
  • What is the error that check50 gives you? Feb 4 at 17:59
0

It's a very subtle thing. The problem is here: printf("Years: %i\n", y); . There are 2 spaces between "Years:" and the result. The spec calls for 1 space here:

Finally, your program should print the number of years required for the llama population to reach that end size, as by printing to the terminal Years: n, where n is the number of years.

Since the automatic grader is looking for a very specific result, the program must produce that result exactly.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .