Question: Write a Java Program using Nested for Loop. That produces following output: printing - for even values and * for odd values. Sample Output: Objective:

Write a Java Program using Nested for Loop. That produces following output: printing - for even values and * for odd values. Sample Output:

Objective: To become familiar with nested for loop.

Instructions:

Step 1: Create a class Named NestedLoop

Step 2: Declare the Main Method Step

3: Declare External for loop and use index I

Step 4: Declare Internal for loop and use index J

Step 5: Use If else statement

a. Use modulus operator (%) to print value of * string

b. Else print (-)

Step 6: Use Println to go to new line

Write a Java Program using Nested for Loop. That produces following output:

OUTPUT Output Hellow (run) X ! zun -*-* - -- -*

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!