Ask Question
6 July, 17:13

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

+2
Answers (2)
  1. 6 July, 19:57
    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. 6 July, 21:10
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers