Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What is output of the following program? #include using namespace std; int func ( int &x , int y = 1 0 ) { if

What is output of the following program?
#include
using namespace std;
int func(int &x, int y =10)
{
if (x % y ==0)
return ++x;
else
return y--;
}
int main()
{
int p =20, q =23;
q = func(p, q);
cout << p <<""<<""<< q << endl;
p = func (q);
cout << p <<""<<""<< q << endl;
q = func (p);
cout << p <<""<<""<< q << endl;
return 0;
}
a.
2220
23
11
b.
2023
1023
1111
c.
2022
2310
1111
d.
2323
20
11

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions

Question

What is the status (prevalence) of unions today?

Answered: 1 week ago