1 )
#include <iostream>
using namespace std;
int main()
{
cout << "Hello, world." << endl;
}
OUTPUT :
2 )
#include <iostream>
using namespace std;
int main()
{
float num1;
float num2;
float avg;
cout << "Enter two numbers" << endl;
cin >> num1 >> num2;
avg = ( num1 + num2 )/2;
cout << "The average is " << avg;
}
OUTPUT:
1 ) Role of compiler is to find if there are any errors in the source code
2 ) float num2 ( ; missed )
3 ) num1 + num2/2 -- wrong
( num1 + num2 ) / 2;
4 ) syntax error is misplacement of the identifiers
logic error is the error that occurs due to the any fault in the programmic logic
Get Answers For Free
Most questions answered within 1 hours.