Untitled

Meshari avatar
Meshari
Java
09/25/2025 9:28 PM
1.4 KB
27
Indexable
Never
package com.mycompany.switch1;
import java.util.Scanner;

public class Switch1 {
    
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        System.out.println("please enter a numbre 1-5");
        int number=input.nextInt();
        switch (number){
            case 1:
                System.out.println(" welcome to MIS");
                for(int row=0;row<6;row++)
                {
                    for(int col=0;col<7;col++)
                    {
                        if((row==0 &&col%3!=0)||(row==1 &&col%3==0)|| row-col==2||row+col==8){
                            System.out.print("* ");
                        }
                        else
                            System.out.print("  "); 
                    } 
                    System.out.println();
                }
                 break;
            case 2:
                System.out.println("welcome to finance");
                break;
            case 3:
                System.out.println("welcome to marketing");
                break;
            case 4:
                System.out.println("welcome to accounting");
                break;
            case 5:
                System.out.println("welcome to management");
                break;
            default:
                System.out.println("please enter a number 1-5");
        }
    }
}
Editor is loading...
Leave a Comment