Write a class LoopExample1 to display the output as below using control structures

0

Assignment: Module 03- Part 02

Write a class LoopExample1 to display the output as below using control structures  Enter the no of terms 3

Write a class LoopExample1 to display the output as below using control structures.

Enter the no of terms 3

Output:

i=1

i=2

i=3

import java.util.Scanner;

public class LoopExample1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.print("Enter the no of terms: ");
        int n = sc.nextInt();
        
        for (int i = 1; i <= n; i++) {
            System.out.println("i=" + i);
        }
    }
}   

Example output:

Enter the no of terms: 3
i=1
i=2
i=3   

👉Write a class FloydExample3 to display the output as below using control structures enter the value of Floyd triangle 4👈

Post a Comment

0Comments
Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !
✨ Updates