Correct the errors in the following code then find the outpu
Solution
1st question
===================
#include<iostream>
using namespace std;
int main()
{
int a,b,c,d,f;
a=4;
b=5;
c=10;
a+=10;
c-=3;
f=a+b;
cout<<a<<b<<c<<f;
}
output will be 145719 like this
to distinguish between a b c f you can rewrite the cout as
follows cout<<a<<\":\"<<b<<\":\"<<c<<\":\"<<f;
first line should be #include<iostream>
followed by using namespace std;
in c++ main can\'t return void, it should be int
and in c++ before using a variable you need to declare it first
so int a,b,c,d,f; is necessary
=======================
for 2nd question
==============
#include<iostream>
using namespace std;
int main()
{
int x,b,y,f;
x=4;
b=10;
y=3;
f=b+y+x;
cin>>y;
f=b+y+x;
cout<<\"f=\"<<f;
}
above code is right code
errors are
1) #include<iostream> not #includ <iostraem>
2)int not Int
3)x,b,y should be declared first before using
4)each statement should be ended with ;so x=4;
5) y=3; not y==3
6)f=b+y+x; not f=b+y+x
7)cin>>y ; not cin<<\"y\"
6) f=b+y+x ; not f=b+y+x
7)cout<<\"f=\"<<f; not cout>>f=>>f
===============
output of the program is depend on one thing if we consider cin<<\"y\"
is for input then output depends on user input
suppose user gives input 5 then output f=19
=======================
please inform you if you need any more clarification
![Correct the errors in the following code then find the output: #include void main[] {a=4; b=5; c=10;a+=b; c-=3; f=a+b; coutSolution1st question =============== Correct the errors in the following code then find the output: #include void main[] {a=4; b=5; c=10;a+=b; c-=3; f=a+b; coutSolution1st question ===============](/WebImages/22/correct-the-errors-in-the-following-code-then-find-the-outpu-1052779-1761548707-0.webp)
![Correct the errors in the following code then find the output: #include void main[] {a=4; b=5; c=10;a+=b; c-=3; f=a+b; coutSolution1st question =============== Correct the errors in the following code then find the output: #include void main[] {a=4; b=5; c=10;a+=b; c-=3; f=a+b; coutSolution1st question ===============](/WebImages/22/correct-the-errors-in-the-following-code-then-find-the-outpu-1052779-1761548707-1.webp)