File tree Expand file tree Collapse file tree 3 files changed +35
-61
lines changed Expand file tree Collapse file tree 3 files changed +35
-61
lines changed Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ # Dimik - Small to Large
2+
3+ There will be three different numbers. They have to be printed from small to large sizes.
4+
5+ ### Solution
6+ * Case number will be according to the number of test case.
7+ * Finding the middle number which is not min or max is the main task.
8+
9+ ### C++
10+ ``` cpp
11+ #include < iostream>
12+ #include < algorithm>
13+ using namespace std ;
14+
15+ int main (){
16+ int test_case;
17+ cin >> test_case;
18+
19+ for (int i = 1; i <= test_case; i++){
20+ int n1, n2, n3;
21+ cin >> n1 >> n2 >> n3;
22+ int a = min(min(n1, n2), n3);
23+ int b = max(max(n1, n2), n3);
24+ if (n1 != a && n1 != b)
25+ {
26+ cout << "Case " << i <<": " << a << " " << n1 << " " << b << endl;
27+ } else if (n2 != a && n2 != b){
28+ cout << "Case " << i <<": " << a << " " << n2 << " " << b << endl;
29+ } else if (n3 != a && n3 != b){
30+ cout << "Case " << i <<": " << a << " " << n3 << " " << b << endl;
31+ }
32+ }
33+ return 0;
34+ }
35+ ```
You can’t perform that action at this time.
0 commit comments