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

OUTPUT Output Hellow (run) X ! zun -*-* - -- -*
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
