Skip to content

Commit 12ea2f9

Browse files
authored
Merge pull request ashutosh97#18 from Ayushjain1722/master
Git Rocks
2 parents 3fe730d + 3e3fa50 commit 12ea2f9

File tree

3 files changed

+143
-0
lines changed

3 files changed

+143
-0
lines changed

AAL/Aditya And Ladders.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Aditya is fond of ladders. Everyday he goes through pictures of ladders online but unfortunately today he ran out of ladder pictures online. Write a program to print �ladder with N steps�, which he can use to get his daily dose of ladder love.
2+
3+
INPUT:
4+
Input contains integer N, the number of steps in the ladder
5+
6+
OUTPUT:
7+
8+
Print the ladder with the gap between two side rails being 3 spaces(� �).
9+
10+
Check the sample output for format of printing the ladder.
11+
12+
CONSTRAINTS:
13+
14+
1<=N<=40
15+
16+
Sample Input : 4
17+
Sample Output:
18+
* *
19+
* *
20+
*****
21+
* *
22+
* *
23+
*****
24+
* *
25+
* *
26+
*****
27+
* *
28+
* *
29+
*****
30+
* *
31+
* *

AAL/x.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#include <iostream>
2+
3+
using namespace std;
4+
5+
int main()
6+
7+
{
8+
9+
int N,i=0;
10+
11+
cin>>N;
12+
13+
while(i<N)
14+
15+
{
16+
17+
cout<<"\n* *";
18+
19+
cout<<"\n* *";
20+
21+
cout<<"\n*****";
22+
23+
i++;
24+
25+
}
26+
27+
cout<<"\n* *";
28+
29+
cout<<"\n* *";
30+
31+
}

PATTERN2.CPP

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#include<iostream.h>
2+
#include<conio.h>
3+
void main()
4+
{
5+
clrscr();
6+
int n,i,j,k;
7+
cout<<"Enter Value Of n: ";
8+
cin>>n;
9+
int space=n-1;
10+
for(i=1; i<=n;i++)
11+
{
12+
cout<<endl;
13+
for(k=space; k>=1;k--)
14+
{
15+
cout<<" ";
16+
}
17+
space--;
18+
for(j=1; j<=i; j++)
19+
cout<<j;
20+
for(j=i-1; j>=1; j--)
21+
cout<<j;
22+
}
23+
cout<<endl;
24+
//-------------------------------------------------------------------
25+
cout<<endl;
26+
cout<<"Enter Value Of n: ";
27+
cin>>n;
28+
space=n-1;
29+
for(i=1; i<=n;i++)
30+
{
31+
cout<<endl;
32+
for(k=space;k>=1;k--)
33+
cout<<" ";
34+
for (j=1; j<=(2*i)-1; j++)
35+
cout<<'*';
36+
space--;
37+
}
38+
space=1;
39+
for (i=1; i<=n-1; i++)
40+
{
41+
cout<<endl;
42+
for(k=space;k>=1; k--)
43+
cout<<" ";
44+
for(j=1;j<=2*(n-i)-1;j++)
45+
cout<<'*';
46+
space++;
47+
}
48+
getch();
49+
}
50+
51+
/*
52+
Enter Value Of n: 5
53+
54+
55+
1
56+
121
57+
12321
58+
1234321
59+
123454321
60+
61+
Enter Value Of n: 6
62+
63+
*
64+
***
65+
*****
66+
*******
67+
*********
68+
***********
69+
*********
70+
*******
71+
*****
72+
***
73+
*
74+
75+
*/
76+
77+
78+
79+
80+
81+

0 commit comments

Comments
 (0)