Фибаноччийн 100-с бага тоонуудыг тооцоолох програм
#include<stdio.h>
#include<conio.h>
main()
{ int old_number=1, current_number=1, next_number;
printf(“1\n”); /*Дарааллийн эхний тоог хэвлэх*/
while (current_number<100)
{ printf(“%d\n”, current_number);
next_number=old_number+current_number;
old_number=current_number;
current_number=next_number;
}
getch();
}
#include<conio.h>
main()
{ int old_number=1, current_number=1, next_number;
printf(“1\n”); /*Дарааллийн эхний тоог хэвлэх*/
while (current_number<100)
{ printf(“%d\n”, current_number);
next_number=old_number+current_number;
old_number=current_number;
current_number=next_number;
}
getch();
}
Comments
Post a Comment