Ask Question
27 April, 08:29

Complete the do-while loop to output every number from 0 to countlimit using printval. assume the user will only input a positive number. for example, if countlimit is 5 the expected output will be 0 1 2 3 4 5

+5
Answers (1)
  1. 27 April, 11:48
    0
    Hi, here's a do-while loop using C + + programming language.

    int countlimit; / / input from user

    int printval = 0; / / initial value of printval

    cout<<"Enter a positive number:"; / / suppose user inputs 5

    cin>>countlimit; / / value 5 will be stored inside variable countlimit

    do{ / / start of do-while loop

    cout<
    printval++; / / increment printval

    }while (printval>=countlimit); / / if condition is true, loops back to beginning of do

    Loops ends and stops printing if countlimit (of 5, in this example) is reached.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Complete the do-while loop to output every number from 0 to countlimit using printval. assume the user will only input a positive number. ...” in 📙 Mathematics 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