English

Write a Program in C++ to Accept Two Integer Values in Main· Function, Pass Them to Function Great() Using Call by Value and Find Greater Number, Function Great() Should Not Return Any Value.

Advertisements

Question

Write a program in C++ to accept two integer values in main· function, pass them to function great() using call by value and find greater number, function great() should not return any value.

Advertisements

Solution

void great (int, int);
void main()
{
  int a, b;
  cout <<"Enter two no=";
  cin>> a>>b;
  great(a, b);
  getch();
}
void great (int p, int q)
{
  if (p > q)
  {
    cout << p << " is big";
  }
  else
  {
    cout << q << " is big";
  }
}
shaalaa.com
  Is there an error in this question or solution?

APPEARS IN

Advertisements
Share
Notifications



      Forgot password?
Use app×