SHOW:
|
|
- or go back to the newest paste.
| 1 | #include <iostream> | |
| 2 | #include <math.h> | |
| 3 | #include <iomanip> | |
| 4 | ||
| 5 | using namespace std; | |
| 6 | int main(){
| |
| 7 | - | |
| 7 | + | |
| 8 | - | int n[20]; |
| 8 | + | |
| 9 | - | int nm; |
| 9 | + | int a[20]; |
| 10 | int n, nm; | |
| 11 | ||
| 12 | - | for(int i = 0; i < 20; i++) {
|
| 12 | + | cout << "Broj elemenata u nizu: "; |
| 13 | - | cout << "n[" << i << "] : "; |
| 13 | + | cin >> n; |
| 14 | - | cin >> n[i]; |
| 14 | + | |
| 15 | for(int i = 0; i < n; i++) {
| |
| 16 | cout << "a[" << i << "] : "; | |
| 17 | - | nm = n[0]; |
| 17 | + | cin >> a[i]; |
| 18 | } | |
| 19 | - | for (int i = 0; i < 20; i++) |
| 19 | + | |
| 20 | - | if(n[i] < nm) nm = n[i]; |
| 20 | + | nm = a[0]; |
| 21 | ||
| 22 | for (int i = 0; i < n; i++) | |
| 23 | if(a[i] < nm) nm = a[i]; | |
| 24 | ||
| 25 | - | for (int i = 0; i < 20; i++) |
| 25 | + | |
| 26 | - | cout << n[i] << " "; |
| 26 | + | |
| 27 | cout << "Niz: " << endl; | |
| 28 | for (int i = 0; i < n; i++) | |
| 29 | cout << a[i] << " "; | |
| 30 | } |