+ 1
#include <iostream> using namespace std; int main() { int i=20,j=10; do {j+=i; i++;} while(j<=200); } how many times loops will run and output of "j"????
5 Antworten
+ 2
the do while loop will loop 9 times, however it will never output the value of "j"
+ 1
9 loops for j=30, 51, 73, 96, 120, 145, 171, 198, 226.
You have to count also 226 because the condition of the do..while is at the end of the loop.
It doesn't give any output because there isn't any command to print the output, like "cout".
+ 1
it does not give any output beacuse there is no cout , or anyother output code
0
output 0 times.
0
thanks@marcram