+ 1
JAVA: K-shaped pattern using symbols
in this code the user inputs a height (number of rows) and a symbol to create the K shaped pattern. But there's a condition: if the user inputs an odd number; the middle row will have a *single* symbol (not two beside each other), and if the user inputs an even number, there won't be a middle symbol. My code displays two symbols in the middle row. How do I correct it? https://code.sololearn.com/cFa524ERjAFS
1 Answer
+ 3
Try use
if (k==count && k!=0){
Line no: 24