Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Straight Max-Min
#include<iostream> using namespace std; #define MAX 1000 int a[MAX]; int main(){ int n; cout << "Enter the number of elements: "; cin >> n; int *a = new int[n]; for(int i = 0; i < n; i++){ cin >> a[i]; } int max = a[0], min=a[0]; for(int k = 1; k < n; k++){ if(a[k] > max) max = a[k]; else if(a[k] < min) min = a[k]; } //for(int j = 0; j < n; j++){ // cout << a[j] << " "; //} cout << "Maximum: " << max << endl; cout << "Minimum: " << min; return 0; }
run
|
edit
|
history
|
help
0
BadCastAllExcept
SL_Dictance challange
Network UVa
decrypt_problem_5
Destroy It!
Do While Meteoro Agustin
GCC compiler bug (should output 0 1)
2021(M2)Simulare:S3:1
series
Полиморфизм. Простейшее ДЕМО.