MIPI_BaseC_WebinarFRTK/05_Lecture05/13_fibonacci_p40.c
2024-11-13 09:22:28 +03:00

24 lines
412 B
C

#include <stdio.h>
int main( void )
{
unsigned int n, i, f1, f2, m;
scanf("%d", &n);
f1 = 1;
f2 = 1;
if (n == 1)
printf("1");
else
if (n != 0)
{
printf("1 1 ");
for (i = 2; i < n; ++i){
m = f1 + f2;
f1 = f2;
f2 = m;
printf("%u ", f2);
}
}
return 0;
}