29.2k views
2 votes
Which line in the following program will cause a compiler error?

1 #include

2 using namespace std;

3

4 int main()

5 {

6 int number = 5;

7

8 if (number >= 0 && <= 100)

9 cout << "passed.\\";

10 else

11 cout << "failed.\\";

12 return 0;

13 }

A)8

B)6

C)10

D)9

2 Answers

5 votes

Answer:

answer is A

the answer is -4

Step-by-step explanation:

hope this helps!

User Clemens Valiente
by
7.5k points
7 votes

Answer:

The answer to this question is the option "A".

Explanation:

In the given c++ program the compile-time error occurs in line number 8. In this program if block is used as an integer variable for checking condition that is number is greater then equal 0 and less then equal to 100 this is wrong.

So, the correct code for check if the block condition can be given as:

if (number>=0 && number<=100)

If we use this code in the if block section then the output of the question is passed.

User Cristian Dinu
by
6.7k points