BrokeMansPC

Program 3 - 4.12.2020 ISPRAVLJEN

Dec 4th, 2020
625
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <math.h>
  3. #include <iomanip>
  4.  
  5. using namespace std;
  6. int main(){
  7.     cout << "Program 3 | Veljko Kovacevic IV3" << endl;
  8.  
  9.     int a[20];
  10.     int n, nm;
  11.  
  12.     cout << "Broj elemenata u nizu: ";
  13.     cin >> n;
  14.  
  15.     for(int i = 0; i < n; i++) {
  16.         cout << "a[" << i << "] : ";
  17.         cin >> a[i];
  18.     }
  19.  
  20.     nm = a[0];
  21.  
  22.     for (int i = 0; i < n; i++)
  23.         if(a[i] < nm) nm = a[i];
  24.  
  25.     cout << "Najmanji broj u nizu je " << nm << endl;
  26.  
  27.     cout << "Niz: " << endl;
  28.     for (int i = 0; i < n; i++)
  29.         cout << a[i] << " ";
  30. }
RAW Paste Data