Wap in java:
a) Void pattern (char ch): Print the following pattern with the given character, if ch = ‘*’ then the
patter is –
* * * * *
* * * *
* * *
* *
*
* *
* * *
* * * *
* * * * *
Answers
Answered by
1
Answer:
CHECK OUT MY ANSWER<DUDE
public class printPattern {
public static void main(String[] args) {
pattern('*'); //you can type whatever you want
}static void pattern(char ch){
for(int i = 5; i >= 2; i--) {
for(int j = i; j > 0; j--) {
System.out.print(ch + " ");
} System.out.println();
}
System.out.println(ch);
for(int k = 2; k <= 5; k++) {
for(int o = k; o > 0; o--) {
System.out.print(ch + " ");
}
System.out.println();
}
}
}
Explanation:
MARK ME BRAINLIEST IF IT HELPS YOU!
Attachments:
Similar questions