More actions
imported>Unknown No edit summary |
(Repair batch-0008 pages from live compare) |
||
| Line 1: | Line 1: | ||
[[송수생]] | [[송수생]] | ||
[[피보나치]] | [[피보나치]] | ||
[[데블스캠프2005/월요일]]에서 만든 | [[데블스캠프2005/월요일]]에서 만든 C언어 피보나치 예제 | ||
#include <stdio.h> | #include <stdio.h> | ||
| Line 38: | Line 38: | ||
return 0; | return 0; | ||
} | } | ||
Latest revision as of 01:40, 27 March 2026
송수생 피보나치 데블스캠프2005/월요일에서 만든 C언어 피보나치 예제
#include <stdio.h>
int main(){
int num_prev=1;
int num_next=1;
int num_temp=0;
int pvio=0;
int count;
printf("숫자를 입력 하세요:");
scanf("%d", &pvio);
count = pvio;
while(1)
{
num_temp =num_prev + num_next;
num_prev = num_next;
num_next = num_temp;
count-- ;
printf("%d\n",num_prev);
if (count == 0)
break;
}
return 0;
}