#include<stdio.h>
#include<conio.h>
void main()
{
int
num1=0, num2=1, num3, n, i;
clrscr();
printf(“Enter
N number: ”);
scanf(“%d”,&n);
if(n>2)
{
Printf(“\n the Fibonacci numbers are:”);
Printf(“%5d%5d”,num1,num2);
i = 2;
while(i<n)
{
num3 = num1 + num2;
printf(“%5d”,num3);
num1 = num2;
num2 = num3;
i++;
}
}
else
{
Printf(“\n0 1”);
getch();
}
OUTPUT:
Enter N number: 9
No comments:
Post a Comment