Josif_tepe

Untitled

Dec 20th, 2025
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.    
  6.     int x;
  7.  
  8.     int prvo_vnesen_broj = 1;
  9.     int najmal_broj;
  10.     int pozicija = 0;
  11.     int pozicija_na_najmal_broj;
  12.    
  13.     while(cin >> x) {
  14.        
  15.         if(prvo_vnesen_broj == 1) {
  16.             // momentalno se naogame na prviot broj vnesen od tastatura
  17.             najmal_broj = x;
  18.             prvo_vnesen_broj = 0;
  19.         }
  20.         else {
  21.             if(x < najmal_broj) {
  22.                 najmal_broj = x;
  23.                 pozicija_na_najmal_broj = pozicija;
  24.             }
  25.         }
  26.        
  27.         pozicija += 1;
  28.     }
  29.    
  30.     cout << najmal_broj << " " << pozicija_na_najmal_broj << endl;
  31.    
  32.     return 0;
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment