limun11

Untitled

Jan 7th, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. bool znamenka(int);
  5. int main()
  6. {
  7. int n;
  8. char odgovor;
  9.  
  10. cout << "Unesite broj: " << endl;
  11. do
  12. {
  13. cin >> n;
  14. cout << "Zelite li nastaviti unos?";
  15.  
  16. cin >> odgovor;
  17. } while (odgovor == 'd' || odgovor == 'D');
  18.  
  19. if (znamenka(n) == true)
  20. cout << "Znamenka 5 se pojavljuje u unijetom broju!" << endl;
  21.  
  22. system("PAUSE");
  23. return 0;
  24. }
  25.  
  26. bool znamenka(int n)
  27. {
  28. int pohrana;
  29. while (n != 0)
  30. {
  31. pohrana = n % 10;
  32. if (pohrana % 5 == 0)
  33. return true;
  34.  
  35. n = n / 10;
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment