1. Determine the output of each of the following programs when it is executed. (a)
#include using namespace std; int main()
{
}
(b)
int a = 10, b = 20, c = 30; if (( a > b) && ( ++b ++c))
cout <“><><“><>
cout <“><><“><><“\n”;>
#include using namespace std; int main()
{
}
(c)
int a = 10, b = 20, c = 30; if (( a <> c++))
cout <“><><“><>
cout <“><><“><><“\n”;>
#include using namespace std; int main()
{
int a = 10, b = 20, c = 30; if (( a <> c++))
cout <“><><“><>
cout <“><><><><“\n”;>
}
(d)
#include using namespace std; int main()
{
}
(e)
int a = 10, b = 20, c = 30; if (( a > b) || ( b++ c++))
cout <“><><“><>
cout <“><><“><><“\n”;>
#include using namespace std; int main()
{
int a = 10, b = 20, c = 30; if (( a > b) && ( b++ c++))
cout <“><>
{
if (( a <><>
cout <“a+b+c><>
cout <“a*b*c><>
}
return 0;
}
(f)
#include using namespace std; int main()
{
int a = 10, b = 20, c = 30; if (( a > b) && ( b++ c++))
cout <“><>
else
{
if (( a <><>
cout <“a+b+c><>
cout <“a*b*c><>
}
return 0;
}
(g)
#include using namespace std; int main()
{
int a = 10, b = 20, c = 30;
if (( a <> c++ ))
{
if (( a <> c++))
cout <“><>
}
else
{
else
cout <“><>
if (( a <><>
cout <“a+b+c><>
cout <“a*b*c><>
}
return 0;
}
(h)
#include using namespace std; int main()
{
int a = 10, b = 20, c = 30,d = 40; if (( a++ <><>
{
if (( a++ <>
{
if (( a++ <=>
cout <“><>
cout <“><>
}
}
else
{
if (( a <><>
cout <“a+b+c><>
else
}
cout <“a*b*c><>
return 0;
}
“a*b*c>“a+b+c>“>“>=>“a*b*c>“a+b+c>“>“>“a*b*c>“a+b+c>“>“a*b*c>“a+b+c>“>“\n”;>“>“>“>“>“\n”;>“>“>“>“\n”;>“>“>“>“>“\n”;>“>“>“>“>