Hello!
I'll take this as a challenge for all newbie in java. This is only for those who are interested. After you take this challenge you are now at your first step in becoming a java expert. These exercise can help developing your mind in making strategic plans, brain teasing and brain storming.
Ok. I'll have 2 challenge for you.
1. Write a program that prompts the user to enter a number(1-10 only) and display it as a pyramid shape.
Hint :
Enter a number(1-10): 7 //for example the user input 7
The program will output this way: Pyramid Shape
1
2 1 2
3 2 1 2 3
4 3 2 1 2 3 4
5 4 3 2 1 2 3 4 5
6 5 4 3 2 1 2 3 4 5 6
7 6 5 4 3 2 1 2 3 4 5 6 7
2. Using the nested loop write a program that prints the following: A BINARY PYRAMID
1
1 2 1
1 2 4 2 1
1 2 4 8 4 2 1
1 2 4 8 16 8 4 2 1
1 2 4 8 16 32 16 8 4 2 1
1 2 4 8 16 32 64 32 16 8 4 2 1
1 2 4 8 16 32 64 128 64 32 16 8 4 2 1
If you attempt to answer and getting the corrent program to these kindly post so that I can check whether your program is good to go.
Edited by harold212011, 05 March 2013 - 10:27 PM.

















