Computer Science, asked by anushkagaur8112, 3 months ago

Write a menu driven program to display following 5 rows pattern: tringle pattern using

Answers

Answered by neerajsai100
0

Answer:

please make me briallinatist

Explanation:

(i)

import java.util.Scanner;

class pattern

{

public static void main ()

{

Scanner sc = new Scanner (System. in);

System.out.println("1. Pattern 1 \n 2. pattern 2");

System.out.println ("Enter choice");

int c = sc.nextInt ();

switch (c)

{

case 1 :

int a, b, c = 1;

for (a = 1; a < = 5; a++)

{

for (b = 1; b < = a; b++)

{

System.out.print (c);

C++;

}

System.out.ptintln ();

}

break:

(ii)

String s = "ICSE"; int I = s.length();

for (int i = 0; i < I; i++)

{

for (int j = 0; j < = i; j++)

{

System.out.print (s.charAt(j)),

}

System.out.println ();

}

break;

default:

System.out.println ("Invalid choice");

}

}

}

Similar questions