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
OTHER - Two robots
Random Vector Generator
function pointer overload
Запаковать строку в JSON (Boost)
Print reverese string non repeated chars
CPP - Arrays - Ex.2
merge without extra space Gap method ALgorithm
Date n Time Macros
inversion of array using merge sort
a