182k views
4 votes
Which line in the following program will cause a compiler error? #include using namespace std; int main() { int number =5; if (number>=0&&<=100) cout<<"passed.\\"; else cout<<"failed.\\"; return 0;

User Napalias
by
3.7k points

1 Answer

2 votes

Answer:

  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. int number =5;
  5. if (number>=0&& number <=100){
  6. cout<<"passed.\\";
  7. }
  8. else{
  9. cout<<"failed.\\";
  10. }
  11. return 0;
  12. }

Step-by-step explanation:

There where multiple errors in the code given in the questions

Line 1: Missing <iostream>

Line 5: The comparison operator was wrong correction is highlighted

Line 12 Missing closing brace for the main function

All the errors have been fixed and the code above compiles

User Steve Tjoa
by
4.3k points