•

Check out our Community Blogs

### Recent Blog Entries

• AndrewStalf

[url=https://audiojungle.net/item/christmas-piano/19056234/]Christmas Piano[/url]

### Popular Tags

Developed by TechBiz Xccelerator

# Java Newbie Challenge

java loop java exercises

This topic has been archived. This means that you cannot reply to this topic.

### #1 Harold

Harold

CC Regular

• Member
• 27 posts

Posted 05 March 2013 - 10:26 PM

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.

### #2 Ritwik I the programmer

Ritwik I the programmer

• 244 posts

Posted 06 March 2013 - 12:06 AM

In addition, if someone feels they are quite adept at tackling logical and algorithmic problems in programming, they can try the problems attached. (Post the soln. in this thread if you solve any, there are 38 problems in the attached file: