Advertisement Remove all ads

Find and Write the Output of the Following C++ Program Code: Note: Assume All Required Header Files Are Already Included in the Program - Computer Science (C++)

Find and write the output of the following C++ program code:

Note: Assume all required header files are already included in the program

void Revert(int &Num, int Last=2)
{
   Last =(Last%2==0)?Last+l: Last - l;
   for(int C=l; C <= Last; C++)
      Num+=C;
)

void main()
{
    int A=20, B=4;
    Revert(A, B) ;
    cout<<A<<"&"<<B<<end1;
    B--;
    Revert{A,B);
    cout<<A<<"#"<<B<<endl;
    Revert{B);
    cout<<A<<"#"<<B<<endl;
}
Advertisement Remove all ads

Solution

35 & 4
38 # 3
38 # 9

Concept: Member of a Class - Data Members and Member Functions (Methods)
  Is there an error in this question or solution?
Advertisement Remove all ads
Advertisement Remove all ads
Advertisement Remove all ads
Share
Notifications

View all notifications


      Forgot password?
View in app×