1. What is the output from the following C++ code fragment? int count = 1; int y
ID: 1936040 • Letter: 1
Question
1. What is the output from the following C++ code fragment? int count = 1; int y = 100; while(count < 100) { y = y - 1; count++; } cout << "y = " << y << " and count = " << count << end; 2. What is the output from the following C++ code fragment? int num = 1; while(num < 10) { cout << num << " "; num += 2; } cout << end; 3. What is the output from the following C++ code fragment if the following values are the inputs to cin? 38 35 71 14 -10 int sum, num; cin >> sum; for(int j = 1; j <= 3; j++) { cin >> num; sum += num; } cout << "Sum = " << sum << endl; 4. What is the output from the following C++ code fragment if the following values are the inputs to cin? 38 35 71 14 -1 int sum, num; sum = 0; cin >> num; while(num != -1) { sum += num; cin >> num; } cout << "Sum = " << sum << endl; 5. Write a do - while loop to get 20 numbers from the user and sum them together. Output the sum after the loop. Declare any variables you need.Explanation / Answer
http://www.chegg.com/homework-help/questions-and-answers/1-output-following-c-code-fragment-int-count-1-int-y-100-count-100-y-y-1-count-cout-y-y-co-q1392080
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.