Which of the following loops prints "Welcome to Java" 10 times?

A:
for (int count = 1; count <= 10; count++) {
System.out.println("Welcome to Java");
}

B:
for (int count = 0; count < 10; count++) {
System.out.println("Welcome to Java");
}

C:
for (int count = 1; count < 10; count++) {
System.out.println("Welcome to Java");
}

D:
for (int count = 0; count <= 10; count++) {
System.out.println("Welcome to Java");
}
a. BD
b. ABC
c. AC
d. BC
e. AB

e In (A), the loop displays Welcome to Java 10 times for count from 1 to 10 . In (B), the loop displays Welcome to Java 10 times for count from 0 to 9 . In (C), the loop displays Welcome to Java 9 times for count from 1 to 9 . In (D), the loop displays Welcome to Java 11 times for count from 0 to 10 . Therefore, the correct answer is AB.

Computer Science & Information Technology

You might also like to view...

Facebook lets you upload photos in the JPG, TIFF, and PNG file formats

Indicate whether the statement is true or false

Computer Science & Information Technology

What is the decimal number 13 in hexadecimal?

A) 1110 B) 4G2 C) D D) 1110

Computer Science & Information Technology