Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
823 B
3
Indexable
Never
import java.util.Scanner;

public class st1{
    public static void main(String[] args) {
        Scanner inp = new Scanner(System.in);
        
        int m = inp.nextInt();
       
        int n = inp.nextInt();
        int arr[][]=new int[m][n];
        
        for (int i = 1; i <=m; i++) {
            for (int j = 1; j <= n; j++) {
                if (i == j ) {
					arr[i-1][j-1]=1;
       
                } else if(i % 2 == 0) {
					arr[i-1][j-1]=2;
          
                } else {
					arr[i-1][j-1]=3;
		
            }
           
        }
   
    }
    for (int i=1;i<=m;i++){
		for(int j=1;j<=n;j++){
			if (arr[i-1][j-1]==1){
				System.out.print("*");
			}
			else if (arr[i-1][j-1]==2){
				System.out.print("#");
			} else 
			System.out.print("$");
		}
		System.out.println();
	}
    
    }}