Simple program to make a stair
here is the code:
#include <iostream.h>
#include <conio.h>
#include <stdio.h>
using namespace std;
int main()
{
int a,x,y;
cout<<"Give a number = ";cin>>a;
for (x=1;x<=a;x++)
{
for (y=1;y<=a+1;y++)
{
if (y<=x)
{
if (y==x) cout<<"|";
else cout<<"| ";
}
else if (y==x+1)
{
cout<<"_";
}
}
cout<<endl;
}
system("pause");
}
0 komentar:
Posting Komentar