Instructions: Following programs has some errors. Locate as many as you can.


int main()

{

double number1, number2, sum;


Cout<<"Enter a number: ";

Cin<< number1;

Cout<<"Enter another number: ";

Cin<
number1 + number2 = sum;

Cout "The sum of two numbers is "<
return 0;

}

Respuesta :

Answer:

#include <iostream>

using namespace std;

int main()

{

   double number1, number2, sum;

   cout<<"Enter a number: ";

   

   cin >> number1;

   

   cout<<"Enter another number: ";

   

   cin >> number2;

   sum = number1 + number2;

   

   cout <<"The sum of two numbers is "<< sum <<endl;

   return 0;

}

Explanation:

The correct program can be seen above.

You need to add  #include <iostream> and using namespace std; before your main function. Other issues are following;

Line 4, 5, 6, 7, 9 -> cout and cin must start with a lowercase letter

Line 5 -> cin >> number1;

Line 7 -> cin >> number2;

Line 8 -> sum = number1 + number2;

Line 9 -> cout << "The sum of two numbers is " << sum << endl;