Advertisement
Josif_tepe

Untitled

Dec 4th, 2022
534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int main() {
  7.     int n;
  8.     cin >> n;
  9.    
  10.     float niza[n];
  11.     for(int i = 0; i < n; i++) {
  12.         cin >> niza[i];
  13.     }
  14.     float x;
  15.     cin >> x;
  16.    
  17.     int dali_brojot_e_najden = 0;
  18.     for(int i = 0; i < n; i++) {
  19.        
  20.         if(niza[i] == x) {
  21.             cout << i << " ";
  22.             dali_brojot_e_najden = 1;
  23.         }
  24.        
  25.     }
  26.    
  27.     if(dali_brojot_e_najden == 0) {
  28.         cout << "Baranata vrednost ne e vo nizata" << endl;
  29.     }
  30.    
  31.    
  32.     return 0;
  33. }
  34. /*
  35.  5
  36.  2 3 5 1 8
  37.  8
  38.  
  39.  
  40.  
  41.  **/
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement