#include<stdio.h>
#include<conio.h>
void main()
{
int num,flag=0,i,j,a=0,b=1,c;
clrscr();
printf("Enter the number:\n");
scannf("%d",&num);
if(num==1)
{
printf("1 is neither prime nor composite");
getch();
exit(0);
}
else
{
for(i=2;i<num;i++)
if(num%i==0)
flag++;
}
if(flag>0)
printf("Number is not prime");
else
{
printf("Number is prime\nFibonacci series is:\n%d\t%d\t",a,b);
for(j=2;j<num;j++)
{
c=a+b;
printf("%d\t",c);
a=b;
b=c;
}
}
getch();
}
0 comments:
Post a Comment