Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- int x, y, z;
- int arr[] = { 1,7,4 };
- int max = arr[0];
- int min = arr[0];
- int average;
- for (int i = 1; i < 3; i++)
- {
- if (arr[i] > max)
- {
- max = arr[i];
- }
- }
- cout << max;
- for (int i = 1; i < 3; i++)
- {
- if (arr[i] < min)
- {
- min = arr[i];
- }
- }
- cout << "\n" << min;
- for (int i = 1; i < 3; i++)
- {
- if ((arr[i] > min) && (arr[i] < max))
- {
- average = arr[i];
- }
- }
- x = max;
- z = min;
- y = average;
- cout << "\n" << x << " is x, " << z << " is z, " << y << " is y";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement