Hello friends today i'm sharing an interesting program,please read this code i make this code very easy to all of you,it really helps you,i used only a simple concepts of c language.
#include<stdio.h>
#include<conio.h>
int main()
{
int i,j,a=0,b=0,c=1;
clrscr();
printf("\n HERE IS YOUR PATTERN:\n\n");
for(i=1;i<=4;i++)
{
for(j=1;j<=i;j++)
{
if(i==1 &&j==1)
printf(" 0");
else if(i==4 && j==4)
printf(" ");
else
{
printf(" %d",c);
a=b;
b=c;
c=a+b;
}
}
printf("\n");
}
getch();
return(0);
}
0 1 1 2 3 5 8 13 21
#include<stdio.h>
#include<conio.h>
int main()
{
int i,j,a=0,b=0,c=1;
clrscr();
printf("\n HERE IS YOUR PATTERN:\n\n");
for(i=1;i<=4;i++)
{
for(j=1;j<=i;j++)
{
if(i==1 &&j==1)
printf(" 0");
else if(i==4 && j==4)
printf(" ");
else
{
printf(" %d",c);
a=b;
b=c;
c=a+b;
}
}
printf("\n");
}
getch();
return(0);
}
Thanking You Friends...
No comments:
Post a Comment
Please Give Me Your Views