pastebin
Add a new paste
View all pastes
Change language
Dutch
English
French
Russian
menu
URL Shortener
Multiple URL shortener
browser info
Whois IP and domain lookup
Capture a Website screenshot
Disqus Chatroom
Registration
pastebin
Paste Search Dynamic
Recent pastes
azureml main
3 hours ago
hook views data
3 hours ago
isPrime
3 hours ago
ajax method
3 hours ago
reverseArr
3 hours ago
sidebar
3 hours ago
input2
3 hours ago
Java lang Exception
3 hours ago
imce set inline
3 hours ago
dijstra
3 hours ago
minMax
#include <iostream>
using
namespace
std;
void
minMax
(
int
n,
double
v
[
100
]
,
int
&min,
int
&max
)
{
min =
100
;
max =
-100
;
for
(
int
i =
0
; i < n; ++i
)
{
cin
>> v
[
i
]
;
if
(
v
[
i
]
> max
)
{
max = v
[
i
]
;
}
if
(
v
[
i
]
< min
)
{
min = v
[
i
]
;
}
}
}
int
main
(
)
{
int
n, min, max;
double
v
[
100
]
;
cin
>> n;
minMax
(
n, v, min, max
)
;
cout
<< min <<
' '
<< max;
return
0
;
}
Parsed in 0.006 seconds