contd..
with 'nested loop'
---------------------------------------------------------------------------------------------------------------------------------
q1)Write a program to display all prime numbers between 0 and 100.
solution
q2)Write a program to display first 20 prime numbers between 0 and 500.
solution
q3)Write a program to display all Armstrong numbers between 0 and 1000.
here we are taking Armstrong number with 3 digit. but more digit also can be taken
solution
q3)Write a program to display first 5 Armstrong numbers between 0 and 1000.
here we are taking Armstrong number with 3 digit. but more digit also can be taken
solution
q4)Write a program to display following numeric pattern.
12345
1234
123
12
1 solution
q5)Write a program to display following numeric pattern.
12345
1234
123
12
1 solution
q6)Write a program to display following numeric pattern.
1
12
123
1234
12345 solution
q7)Write a program to display following numeric pattern.
11111
2222
333
44
5 solution
q8)Write a program to display following numeric pattern.
11111
2222
333
44
5 solution
q9)Write a program to display following numeric pattern.
5
44
333
2222
11111 solution
q10))Write a program to display following numeric pattern.
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
4 4 4 4 4
solution
q11)Write a program to display following numeric pattern.
1 1 1 1 1
2 2 2
3
solution
q12)Write a program to display following star pattern.
a) *
** solution
***
****
*****
b)
* * * * *
* * * *
* * *
* *
*
solution
q13)Write a program to display following numeric pattern.
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5 solution
q14)Write a program to display following numeric pattern.
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
solution
q15)Write a program to display following numeric pattern.
1 2 3 4 5
2 4 6 8 10
3 6 9 12 15
solution
q16)Write a program to display following star pattern.
*
* * solution
* *
* *
* *
or solution
q17)Write a program to display following star pattern.
*
* * solution
* *
* *
* * * * * * * * *
or solution
q18)Write a program to display following star pattern.
*
* * solution
* *
* *
* ** * * * * * *
or solution
q19)Write a program to display following star pattern.
*
* * solution
* *
* *
* * * * * * * * *
* *
* *
* *
* *
* *
* * * * * * * * *
*
*
*
q20)Write a program to display following star pattern.
* * * * * *
* * * *
* * *
* *
*
*
* * solution
* * *
* * * *
* * * * *
q21) Write a program to get following numeric pattern.
0
01
012
0123 solution
012
01
0
q22) WAP to display following.
A
AB
ABC
ABCD
ABCDE
solution
q23) WAP to get following
ABCDE
ABCD
ABC
AB
A
solution
q24)WAP to get following.
+
+
++++++++
+
+
solution
q25) WAP to get following.
1
121
12321
1234321
123454321
solution 26) WAP to get following
* * * * *
* * * * *
* * * * *
* * * * * solution
27) WAP to get following
* * * * *
* * * * *
* * * * *
* * * * *
* **** solution
28)WAP to get following
* * * * *
* * * * *
* * * * *
* * * * *
Solution
29)WAP to get following
* * * * *
* * * * *
* * * * *
* * * * *
* * * * * * * * * * * * * * * * *
* * * * *
* * * * *
* * * * *
* * * * *
solution
30)WAP to get following
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
solution
31)WAP to get following.
1 2 3 4 5
1 2 3 4 5
1 1 1 1 1
1 1
1 1
1 1
1 1 1 1 1
solution
37)WAP to get following.
1 0 1 0 1
0 1 0 1 0
1 0 1 0 1
0 1 0 1 0
1 0 1 0 1
solution
38)WAp to get following
11011
11011
00000
11011
11011
solution
39)WAp to get following.
10001
01010
00100
01010
10001
solution
40)WAp to get following.
12345
23455
34555
45555
55555
solution
with 'nested loop'
---------------------------------------------------------------------------------------------------------------------------------
q1)Write a program to display all prime numbers between 0 and 100.
solution
q2)Write a program to display first 20 prime numbers between 0 and 500.
solution
q3)Write a program to display all Armstrong numbers between 0 and 1000.
here we are taking Armstrong number with 3 digit. but more digit also can be taken
solution
q3)Write a program to display first 5 Armstrong numbers between 0 and 1000.
here we are taking Armstrong number with 3 digit. but more digit also can be taken
solution
q4)Write a program to display following numeric pattern.
12345
1234
123
12
1 solution
q5)Write a program to display following numeric pattern.
12345
1234
123
12
1 solution
q6)Write a program to display following numeric pattern.
1
12
123
1234
12345 solution
q7)Write a program to display following numeric pattern.
11111
2222
333
44
5 solution
q8)Write a program to display following numeric pattern.
11111
2222
333
44
5 solution
q9)Write a program to display following numeric pattern.
5
44
333
2222
11111 solution
q10))Write a program to display following numeric pattern.
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
4 4 4 4 4
solution
q11)Write a program to display following numeric pattern.
1 1 1 1 1
2 2 2
3
solution
q12)Write a program to display following star pattern.
a) *
** solution
***
****
*****
b)
* * * * *
* * * *
* * *
* *
*
solution
q13)Write a program to display following numeric pattern.
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5 solution
q14)Write a program to display following numeric pattern.
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
solution
q15)Write a program to display following numeric pattern.
1 2 3 4 5
2 4 6 8 10
3 6 9 12 15
solution
q16)Write a program to display following star pattern.
*
* * solution
* *
* *
* *
or solution
q17)Write a program to display following star pattern.
*
* * solution
* *
* *
* * * * * * * * *
or solution
q18)Write a program to display following star pattern.
*
* * solution
* *
* *
* ** * * * * * *
or solution
q19)Write a program to display following star pattern.
*
* * solution
* *
* *
* * * * * * * * *
* *
* *
* *
* *
* *
* * * * * * * * *
*
*
*
q20)Write a program to display following star pattern.
* * * * * *
* * * *
* * *
* *
*
*
* * solution
* * *
* * * *
* * * * *
q21) Write a program to get following numeric pattern.
0
01
012
0123 solution
012
01
0
q22) WAP to display following.
A
AB
ABC
ABCD
ABCDE
solution
q23) WAP to get following
ABCDE
ABCD
ABC
AB
A
solution
q24)WAP to get following.
+
+
++++++++
+
+
solution
q25) WAP to get following.
1
121
12321
1234321
123454321
solution 26) WAP to get following
* * * * *
* * * * *
* * * * *
* * * * * solution
27) WAP to get following
* * * * *
* * * * *
* * * * *
* * * * *
* **** solution
28)WAP to get following
* * * * *
* * * * *
* * * * *
* * * * *
Solution
29)WAP to get following
* * * * *
* * * * *
* * * * *
* * * * *
* * * * * * * * * * * * * * * * *
* * * * *
* * * * *
* * * * *
* * * * *
solution
30)WAP to get following
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
solution
31)WAP to get following.
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
2 2 2 2 2
0 0 0 0 0
2 2 2 2 2
0 0 0 0 0
2 2 2 2 2
1 1 1 1 1
0 0 0 0 0
1 1 1 1 1
0 0 0 0 0
1 1 1 1 1
34) WAp to get following.
0 2 0 2 0
0 2 0 2 0
0 2 0 2 0
0 2 0 2 0
0 2 0 2 0
x x x x x
x 0 0 0 x
x 0 0 0 x
x 0 0 0 x
x x x x x
36)WAP to get following.1 1 1 1 1
1 1
1 1
1 1
1 1 1 1 1
solution
37)WAP to get following.
1 0 1 0 1
0 1 0 1 0
1 0 1 0 1
0 1 0 1 0
1 0 1 0 1
solution
38)WAp to get following
11011
11011
00000
11011
11011
solution
39)WAp to get following.
10001
01010
00100
01010
10001
solution
40)WAp to get following.
12345
23455
34555
45555
55555
solution