Question

What will the following program segment display? int funny = 7, serious = 15; funny =...

What will the following program segment display?

int funny = 7, serious = 15;

funny = serious % 2;

if (funny != 1)

{ funny = 0;

serious = 0;

}

else if (funny == 2)

{ funny = 10;

serious = 10;

}

else

{ funny = 1;

serious = 1;

}

cout << funny << serious << endl;

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
What will the following program segment display? int funny = 7, serious = 15; funny =...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • 1) What will each of the program segment display int x = 1; while (x <...

    1) What will each of the program segment display int x = 1; while (x < 10); x++; cout << x; int x = 1; while (x < 10) X++; cout << x;

  • 5. (7 pts) What wil display on the output screen after following program is executed? includeciostream...

    5. (7 pts) What wil display on the output screen after following program is executed? includeciostream using namespace std int b 40 int A function(int a) int main (void) int c 7, b 15 cout<cA function (e) <cendla return 6 int A function (int a) int i cout<<b<<endl; if (a>-0) else return i i-ai i--ai Ans5 6. (7 pts) Show what will appear on the output screen after the following program is executed tincludeciostream> using namespace std; void A function...

  • What is the output of the following program segment? int count = 5; while(--count > 0)...

    What is the output of the following program segment? int count = 5; while(--count > 0) cout << count << " "; cout << endl;

  • 18 C++ 1. What is the output of the following program segment? int y-22: while ((y...

    18 C++ 1. What is the output of the following program segment? int y-22: while ((y 3) != 0) cout << y<< "": y=y-2; The output is 2. Suppose that the input is 100, 20,-8, 50, 20. What is the output of the following C++ code? int sum0 int num: int j cin >> num: if (num < 0) continue зит зит + num; cout<< sum << endl; The output is

  • 31. The following code segment is syntactically correct:              int number{20};          cout << number <<...

    31. The following code segment is syntactically correct:              int number{20};          cout << number << setbase(16) << " " << number                               << setbase(10) << " " << number                                 << showpos << " " << number << endl;                 T__   F__       32. The following statement wants to determine if ‘count’ is outside the     range of 0 through 100:             if (count < 0 && count > 100)                                             T__   F__ 33. There is...

  • C++ What output does the following program produce? int getValue(int a, int b, int n); int...

    C++ What output does the following program produce? int getValue(int a, int b, int n); int main() cout << getValue(1, 7, 7) << endl; return 0; } // end main int getValue(int a, int b, int n) int returnValue = 0; cout << "Enter: a = " < a << " b = " << b << endl; int c = (a + b)/2; if (C* C <= n) return value = c; else returnValue = getValue(a, C-1, n); cout...

  • Given the following program segment: int limit = 4; int first = 5 int j; for...

    Given the following program segment: int limit = 4; int first = 5 int j; for (j=1; j <= limit; j++) { cout << first * j << endl; first = first + (j -1); } cout << endl; write a while loop and a do...while loop that both have the same output.

  • 5. What is the output of the following section of a program int a[10] = {2,5,1,6,x,7,0,3,y,8};       ...

    5. What is the output of the following section of a program int a[10] = {2,5,1,6,x,7,0,3,y,8};        for(int i=0;i<9;i++)      a[i]=a[i+1]; for(int i=0;i<8;i++)      cout<<a[i]<<” “; cout<<endl; 6. What will be shown on the output screen after following statements are executed? char a[ ]="I have a part time job"; int c=x, i=0 while(a[i]!=’\0’){      if(a[i]==' '){           c++;           cout<<endl;      }      else           cout<<a[i];      i++; } cout<<c<<endl; 7. After following statements are executed, what are the outputs char a[ ]= "Fresno City College";        for (i...

  • Program is in C++, program is called airplane reservation. It is suppose to display a screen...

    Program is in C++, program is called airplane reservation. It is suppose to display a screen of seating chart in the format 1 A B C D E F through 10. I had a hard time giving the seats a letter value. It displays a correct screen but when I reserve a new seat the string seats[][] doesn't update to having a X for that seat. Also there is a file for the struct called systemUser.txt it has 4 users...

  • 5. (6 pts) What is the outputs of following section of a program? int a[10] =...

    5. (6 pts) What is the outputs of following section of a program? int a[10] = {1,2,3,2, 5, 6, 7, 8 , 9, y): int i - 0, 30: while (i<10) coutくく3くくendl ; 6. (6 pts) What is output of following set of instructions in a C++ program: (In this problem both x and y represent positive integers) int a[10]={-1, 3=0; 2, 7, -4, 11, -2, 3, -9); x, -y, int for (int i-0:i<10:i++) if (a [1]<0) s+ai] coutくく3(くend-; 7....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
Active Questions
ADVERTISEMENT