Respuesta :
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; //print initial value
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.
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; //print initial value
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.
Answer:
while ( printVal <= countLimit );
Step-by-step explanation:
