"The best way to cheer yourself up is to try to cheer somebody else up." Mark Twain
Showing posts with label Iteration( Floyd triangle). Show all posts
Showing posts with label Iteration( Floyd triangle). Show all posts

Monday, January 11, 2010

Floyd Triangle

/*
1
0 1
1 0 1
0 1 0 1
1 0 1 0 1
*/


#include<iostream.h>
#include<conio.h>

void main()
{
int ele = 1;
int h, i, j;
cout<<"\n Enter Height :";
cin>>h;
for(i=1; i<=h; i++)
{for(j=1;j<=i;j++)
{
cout<
if(ele == 0)
ele = 1;
else
ele = 0;
}
cout<<"\n";
}
getch();
}
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off.
Now Playing: Ballade Pour Adeline

About Me

My photo
I m an IT lecturer of a college. I love social-work. I want to do something beneficial for society before dying , that can promote our society, to some extent.