output would be
10, 10
Every time we are doing increment of 1 in sum and increment of 1 in count. Loop exits when counter becomes 10.
write the output produced from the console? count=0; sum=0; while ( count < 10) { sum...
What will be the output produced from the following nested loops: sum = 0; a = 7; while (a<10) { for (k = a; k<=10; k++) sum +=k; a++; } cout<< sum << endl; int x, y; for (x = 1; x<=5; x++) { cout<<x<<endl; for (y = 2; y <x; y++) cout<< y<<endl; }
What does the following nested loop structure output? count = 1; while (count <= 11) {innerCount = 1 while (innerCount <= (12 - count)/2) {cout << " "; innerCount++;} innerCount = 1; while (innerCount = 1; while (innerCount <= count) {cout << "0"; innerCount++;} cout << endl; count++;} What does the following nested loop structure output? count = 1; while (count <= 10) {innerCount = 1; while (innerCount <= 10) {cout << setw(5) << count * innerCount; innerCount++;} cout <<...
Write a program that prints the following console output using the while-loop and for-loop D not use if-else, setw) and ciomanip> for this problem. .Before you open a Word file to copy the screen shots, tell Dr. Jo. Save the Word file as your name in your flash drive. .Take a screen-shot the code and paste to the Word file. (5 points). Take a screen-shots of the console output and paste to the Word file. (5 points) Save the Word...
In the pseudocode below: Function Integer perfect(Integer n) Declare Integer count = 0 Declare Integer sum = 0 While count < n Set count = count + 1 Set sum = sum + count End While Return sum End Function Function Integer perfect_sum(Integer n) Declare Integer count = 0 Declare Integer sum = 0 While count < n Set count = count + 1 Set sum = sum + perfect(count) End While Return sum End Function Module main() Display perfect_sum(5)...
What is the output of the following program segment? int count = 5; while(--count > 0) cout << count << " "; cout << endl;
Write a program that reads an integer (greater than 0) from the console and flips the digits of the number, using the arithmetic operators // and %, while only printing out the even digits in the flipped order. Make sure that your program works for any number of digits and that the output does not have a newline character at the end. main.py (show code python)
Write the branch-friendly pseudo code int i = 10; int sum = 0; while (i >= 0) { sum = sum + i; i = i – 1; }
17. (2 points) C++ Using a while loop, write the code statements to sum 10 integers entered by a user. Display the sum. Hint: Be sure to declare, initialize, and use appropriate variables to count the repetitions and accumulate the sum.
What is the output of the following C++ code? int count = 1; int num = 25; while (count < 25) { num--; count++; } cout << count « " " « num << endl i 25 1 0 24 1 0 25 0 0 24 0 In this while loop statement, while (counter < 10), where counter is an int variable. Which statement below is an equivalent way to write this while statement? while (10 < counter) while (9...
Q7. While (sum <100) or (flag - 1) add 5 to sum endWhile 911. for count = 20 down to 1 add 1 to value endFor;