This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: cin >> temp; sum += temp; //product *= temp; } average = (float)sum/number; cout << "The sum is: " << sum << "\n"; cout << "The average is: " << average << "\n"; // cout << "The product is: " << product; return 0; } ccd4dcad84fbb5b4d254aa36dc8f02ccd4d0ed9f.doc Page 2 of 2 Problem 2 # include <iostream> # include <limits> using namespace std; int main (void) { int number, temp, min = INT_MAX, max = INT_MIN, range; cout << "Enter the number of elements: "; cin >> number; for (int i = 1; i <= number; i++) { cout << "Enter a number: "; cin >> temp; if (temp > max) max = temp; if (temp < min) min = temp; } cout << "The smallest number is: " << min << "\n"; cout << "The largest number is: " << max << "\n"; cout << "The range is: " << max  min; return 0; }...
View
Full
Document
This note was uploaded on 04/24/2010 for the course COS 120 taught by Professor Bonev during the Fall '08 term at American University in Bulgaria.
 Fall '08
 Bonev

Click to edit the document details