Ask Question
24 April, 11:23

What is the output of the following program fragment? (alpha and beta are int variables and △ is a blank.) alpha = 2463; beta = 72; cout << "123456789" << endl << setw (5) << alpha << endl << setw (5) << beta << endl; A) 123456789 24630 72000 B) 123456789 △2463 72 C) 123456789 △2463 △△△ 72 D) 123456789 △2463 △△72 E) none of the above

+4
Answers (2)
  1. 24 April, 12:10
    0
    C. option is the answer.

    Explanation:

    First line print is straightforward. Second line introduces one blank (because of setw ()) before alpha value output. Third line puts 3 blanks before beta value output.

    123456789

    △2463

    △△△72

    setw () function sets field width. It is part of the iomanip library. Default justification is left, i. e. spaces or blanks start from the left.

    setw () can be inserted or extracted on input streams or output streams.
  2. 24 April, 14:11
    0
    Correct option is C if each output includes a new line which not shown in option I think that is typing mistake and output will be like this

    123456789

    2463

    72

    Explanation:

    C is correct option because it generate output like option C because the function setw sets width of output to 5 character so in alpha total characters are 4 so it print 4 characters after a blank space character and in beta total characters are 2 so it prints those 2 characters after printing three blank spaces;

    123456789

    2463

    72
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “What is the output of the following program fragment? (alpha and beta are int variables and △ is a blank.) alpha = 2463; beta = 72; cout ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers