Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- bool znamenka(int);
- int main()
- {
- int n;
- char odgovor;
- cout << "Unesite broj: " << endl;
- do
- {
- cin >> n;
- cout << "Zelite li nastaviti unos?";
- cin >> odgovor;
- } while (odgovor == 'd' || odgovor == 'D');
- if (znamenka(n) == true)
- cout << "Znamenka 5 se pojavljuje u unijetom broju!" << endl;
- system("PAUSE");
- return 0;
- }
- bool znamenka(int n)
- {
- int pohrana;
- while (n != 0)
- {
- pohrana = n % 10;
- if (pohrana % 5 == 0)
- return true;
- n = n / 10;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment