Ask Question

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./n";

10. else

11 cout << "failed./n";

12 return 0;

13 }

A) 8 B) 6 C) 10 D) 9

+5
Answers (1)
  1. 24 March, 02:58
    0
    The answer is "Option A".

    Explanation:

    In the given C+ + Language program on line 8 compile-time error will occur, because in the code the conditional statement is used. In if block, we check two conditions together, which is the number variable value is greater than equal to 0 and check less than equal to 100. In this condition statement, a AND operator is used that execute when both condition is true, but in the last condition, we do not define a variable name that, checks value. That's why the program will give an error on line 8.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “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 = ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers