Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int x;
- int prvo_vnesen_broj = 1;
- int najmal_broj;
- int pozicija = 0;
- int pozicija_na_najmal_broj;
- while(cin >> x) {
- if(prvo_vnesen_broj == 1) {
- // momentalno se naogame na prviot broj vnesen od tastatura
- najmal_broj = x;
- prvo_vnesen_broj = 0;
- }
- else {
- if(x < najmal_broj) {
- najmal_broj = x;
- pozicija_na_najmal_broj = pozicija;
- }
- }
- pozicija += 1;
- }
- cout << najmal_broj << " " << pozicija_na_najmal_broj << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment