Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Display in C++ 1) What is the displayed value of count3? int i, ntemps = 4; // total number of temp values = 4 int

Display in C++

1) What is the displayed value of count3?

int i, ntemps = 4; // total number of temp values = 4 int temp; // temperature value int count1 = 0, count2 = 0, count3 = 0, count4 = 0; int sum1 = 0, sum2 = 0, sum3 = 0; for ( i = 0; i < ntemps; i++) { cout << Enter temperature value cin >> temp; if (temp > 50) count1++; if (temp > 40 && temp <= 60) count2++; if (temp > 40 || temp <= 50) count3++; sum1 = temp; sum2 = sum2 + temp; sum3 = temp + 10; } cout << count1 << count2 << count3 << sum1 << sum 2<< sum3 << i; Assume the user has entered the following 4 temperature values: 50, 60, 70, 80 2) What is the displayed value of i?

int i, ntemps = 4; // total number of temp values = 4 int temp; // temperature value int count1 = 0, count2 = 0, count3 = 0, count4 = 0; int sum1 = 0, sum2 = 0, sum3 = 0; for ( i = 0; i < ntemps; i++) { cout << Enter temperature value cin >> temp; if (temp > 50) count1++; if (temp > 40 && temp <= 60) count2++; if (temp > 40 || temp <= 50) count3++; sum1 = temp; sum2 = sum2 + temp; sum3 = temp + 10; } cout << count1 << count2 << count3 << sum1 << sum 2<< sum3 << i; Assume the user has entered the following 4 temperature values: 50, 60, 70, 80

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David Kroenke

11th Edition

0132302675, 9780132302678

More Books

Students also viewed these Databases questions