WAP = Write a Program
Thank you Cardi B for ruining programming for me! 😢😞Question 1
WAP to a print the following pattern. User entersrows
[See Solution]
rows = 4 ******** *** *** ** ** * * * * ** ** *** *** ********
Question 2
WAP to print the following pattern. User will enter number of rows (rows >= 2). If user
enters rows < 2 then no pattern is printed. You can also add a second variable called
columns that takes how many stars * to print in the first and last line.
[See Solution]
******** * * * * * * * * ********
Question 4
WAP to print the following pattern. User entersrows.
[See Solution]
rows = 5
* * * * *
* * * *
* * *
* *
*
Question 5
WAP to print the following pattern. User entersrows.
[See Solution]
rows = 5
*
* *
* * *
* * * *
* * * * *
Question 6
WAP to print the following pattern. User entersrows.
[See Solution]
rows = 5
*
* *
* *
* *
* * * * *
Question 7
WAP to print the following pattern. User entersrows.
[See Solution]
1 1 2 1 2 3 1 2 3 4 1 2 3 4 5
Question 8
WAP to print the following pattern. User entersrows.
[See Solution]
1 2 3 4 5 1 2 3 4 1 2 3 1 2 1
Question 9
WAP to print the following pattern. User entersrows.
[See Solution]
1 1 2 1 x 3 1 x x 4 1 x x x 5 1 2 3 4 5 6
Question 10
WAP to print the following pattern. User entersrows.
[See Solution]
A A B A A B C B A A B C D C B A
Question 11
WAP to print the following pattern. User entersrows.
[See Solution]
********1******** *******2*2******* ******3*3*3****** *****4*4*4*4***** ****5*5*5*5*5**** ***6*6*6*6*6*6*** **7*7*7*7*7*7*7** *8*8*8*8*8*8*8*8*
Question 12
WAP to print the following pattern. User entersrows.
[See Solution]
For rows = 3 we have:
* * * * * * * * *
Question 13
WAP to print the following pattern. User entersrows.
[See Solution]
For rows = 5 we have:
*
* *
* *
* *
* *
* *
* *
* *
*
Question 14
WAP to print the following pattern. User entersrows.
[See Solution] In case of
rows = 7 we get:
* ** *** **** *** ** *
In case rows = 4
* ** ** *
Question 15
WAP to print the following pattern. User entersrows.
[See Solution]
For rows = 3
3 44 555 6666 555 44 3
For rows = 2
2 33 444 33 2
For rows = 5
5 66 777 8888 99999 101010101010 99999 8888 777 66 5
Question 16
WAP to print the following pattern. User entersrows.
[See Solution]
For rows = 4
1 2 3 4 5 6 7 8 9 10
For rows = 2
1 2 3
Question 17
WAP to print the following pattern. User entersrows.
[See Solution]
For rows = 3
1 2*3 4*5*6 4*5*6 2*3 1
If rows = 4
1 2*3 4*5*6 7*8*9*10 7*8*9*10 4*5*6 2*3 1
Question 18
WAP to print the following pattern (Pascal's Triangle). User entersrows.
[See Solution]
For rows = 5
1 1 1 1 2 1 1 3 3 1 1 4 6 4 1
The pattern is derived in the pascal's triangle using values in the previous row.
1 1 1 1 (1 + 1) 1 1 (1 + 2) (2 + 1) 1 1 (1 + 3) (3 + 3) (3 + 1) 1
Question 19
WAP to print the following pattern (Hollow Rhombus). User entersrows.
[See Solution]
For rows = 3
****** ** ** * * * * ** ** ******
For rows = 5
********** **** **** *** *** ** ** * * * * ** ** *** *** **** ***** **********
Question 20
WAP to print the following pattern (Butterfly pattern) [See Solution]
For rows = 3
* * ** ** ****** ****** ** ** * *
For rows = 5
* * ** ** *** *** **** **** ********** ********** **** **** *** *** ** ** * *