#print strings next to each other

14 messages · Page 1 of 1 (latest)

native siren
#

`import java.util.Arrays;
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Please enter a number between 10 and 99.");

    String one =
                    "   **\n" +
                    "    *\n" +
                    "    *\n" +
                    "    *\n" +
                    "    *\n";

    int num = scanner.nextInt();

    if(num > 9  && num < 100) {

        for (int i =0; i<2; i++) {
            String numstring = Integer.toString(num);
            if (numstring.contains("1")) {
                System.out.print(one);
            }
        }
    }
    else {
        System.out.println("Please enter a number.");
    }
}

}`

output:
Please enter a number between 10 and 99.
11
**
*
*
*
*
**
*
*
*
*

weak orchidBOT
#

This post has been reserved for your question.

Hey @native siren! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

native siren
#

the output of 11 is under each other

#

instead next to each other

kind snow
#

what do you mean by that

native siren
#

is there a fix to it

kind snow
#

what two lines

#

i have literally no idea what you're talking about

#

what output do you want, and please use codeblocks

native siren
#

omg

kind snow
#

use codeblocks

#

see #❗︱how-to-get-help #6