Hello!
I have been trying to solve this challenge for a while now, but every time I run my code, I only get the output: “Where should I start counting?”, and then the program runs until I hit the stop button. Then, in the output, it also says: “Program ended with exit code: 9” What does that mean, and why doesn’t my code work?
I have been looking around on the forum a bit, and while I have picked up a few tips here and there, I haven’t been able to find any solution to my problem. I would be very thankful if I could get some help, I post my code below
[code]#import <readline/readline.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, const char * argv[])
{
printf(“Where should I start counting? “);
const char *numStart = readline(NULL); //Takes whetever number the user puts in and stores it in the variable numStart
int i = atoi(numStart); //Converts numStart, as a string, to a integer
printf(”%d\n”, i); //Prints out the number the user puts in (as a decimal since it’s a integer)
for (i; i >= 0; i -= 3) {
printf("%d\n", i);
if (i % 5 == 0) {
printf("Found one!\n");
}
}
return 0;
}[/code]
Thanks in advance!