Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // sol-final-ex1.cpp : Defines the entry point for the console application.
- /*find the max between 3 num entered by user
- Print A or B or F depending max value
- print A if 90>= max <=100
- print B if 80>= max <90
- print F if max < 80
- */
- #include "stdafx.h"
- #include "iostream"
- using namespace std;
- int main()
- {
- int a, b, f,max=0;
- cout << "\tEnter Three Number\n";
- cout << "Num 1 : ";
- cin >> a;
- cout << "Num 2 : ";
- cin >> b;
- cout << "Num 3 : ";
- cin >> f;
- max = a;
- if (max > b && max > f)
- max = a;
- else if (b > max && b > f)
- max = b;
- else if (f > max&&f > b)
- max = f;
- cout << "\nmax : " << max << endl;
- if (max <= 100 && max >= 90)
- cout << "Num 1 : " << a << endl;
- else if (max < 90 && max >= 80)
- cout << "Num 2 : " << b << endl;
- else if (max < 80)
- cout << "Num 3 : " << f << endl;
- else
- cout << "Number out of range\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement