Advertisement
llvlleo1810

tìm số đẹp (lộc phát)

Apr 17th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.29 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int n;
  5.  
  6. bool ktlocphat(int n) {
  7.  while(n > 0) {
  8.   int t = n % 10;
  9.   if (t != 0 && t != 6 && t != 8)
  10.    return false;
  11.   n = n / 10;
  12.  }
  13.  return true;
  14. }
  15.  
  16. int main() {
  17.  cin >> n ;
  18.  if(ktlocphat(n))
  19.   cout << "1";
  20.  else  cout << "0";
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement