Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int trazeni_broj = 30;
- int pojavljuje = 0;
- int duljina = 51;
- int polje[duljina];
- for (int i = 0; i < duljina; i++)
- {
- polje[i] = i+10;
- cout << "Index: " << i << " Vrijednost: " << polje[i] << endl;
- }
- polje[50] = 30;
- for (int i = 0; i < duljina; i++)
- {
- if (polje[i] == trazeni_broj)
- {
- pojavljuje++;
- }
- }
- cout << "Broj " << trazeni_broj << " se pojavljuje " << pojavljuje << " puta." << endl;
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment