//#include <stdio.h>
long fib(long num);
int main(void){
int seriesSize;
scanf ("%d", &seriesSize);
if (seriesSize <2)
seriesSize =2;
printf("First %d Fibonacci numbers: \n", seriesSize);
for (int looper = 0; looper < seriesSize; looper++)
{
if(looper % 5)
printf(", %81d", fib(looper));
else
printf("\n%81d", fib(looper));
}
printf("\n");
return 0;
}
long fib(long num)
{
if (num==0 || num==1)
return num;
return (fib (num-1) + fib (num-2));
}
And no matter how much I think about it, I don't know the meaning of if (looper % 5) means Please help me It works when I use the extension cpp, but it comes out weird
With c, the looper is
D:\System\Desktop\2.c [Error] 'for' loop initials are only allowed in C99 or C11 mode
There's an error, but I don't know ㅠ<
I don't know about C, but...
In C language, the bowl type is 1 is true and 0 is false.
In fact, if it's not 0, it's considered true.
So looper %5 is false or true if looper is a multiple of 5
The error message for the for statement seems to be because you declared a looper in the for statement.
Please declare the looper outside, and in the for statement, remove the int and execute it
573 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
578 Understanding How to Configure Google API Key
917 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.