0

So, when i execute my program it reads one less value than it should, and I think the problem is with the scanf/fgets, but i dont know hot to work it out. Help?

 int main(){

int n;
char s[200];

scanf("%i", &n);

for (int i = 0; i<n+1; i++)
{
    if (i==0)
    {
        continue;
    } else if (i >=1) {
        fgets(s, 200, stdin);

        first(s);
        second(s);
        third(s);
        puts(s);
    }
}


return 0;
}
melpomene
  • 84,125
  • 8
  • 85
  • 148
Márj
  • 3
  • 2

0 Answers0