Computer Science, asked by kalasangam2000, 7 months ago

1
123
12345
1234567
write a java program for the pattern​

Answers

Answered by Anonymous
0

Answer:

java pattern to code

import java.util.*;

public class Asn4{

public static void main(String[] args){

Scanner bob=new Scanner(System.in);

System.out.print("Enter a number: ");

int c=bob.nextInt();

System.out.print("Enter a character: ");

String d=bob.next();

bob.close();

F5(c, d);

}

public static void F5(int c, String d){

for (int i=0; i<c;i++){

for (int f=0; f<=c-i; f++){

System.out.print(" ");

}

for (int x=1; x<=1+2*i; x++){

System.out.print(d);

}

System.out.println("");

}

}

}

don't hesitate to correct,it I gave what i know

Similar questions