334,985 views
9 votes
9 votes
BEGINNERS COMP. SCI JAVA CODING PLEASE HELP!!!
(All questions shown in picture please!)

BEGINNERS COMP. SCI JAVA CODING PLEASE HELP!!! (All questions shown in picture please-example-1
User Kabangi Julius
by
2.5k points

1 Answer

19 votes
19 votes

Answer:

8)

Scanner scanner = new Scanner(System.in);

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

int num = scanner.nextInt();

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

System.out.print("* ");

}

9)

for (int i = 1; i <= 10; i++) {

System.out.print(i * i + " ");

}

10)

for (int i = 1; i < 9; i++) {

if (i % 3 == 0) {

System.out.println("?");

} else {

System.out.println(i);

}

}

11)

Scanner scanner = new Scanner(System.in);

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

int n = scanner.nextInt();

int factorial = 1;

for (int i = 1; i <= n; i++) {

factorial = factorial * i;

}

System.out.println(factorial);

User Mory
by
3.1k points