Advertisement
Spocoman

08. Even Number

Nov 2nd, 2023
636
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int n;
  7.     cin >> n;
  8.  
  9.     while (n % 2 != 0) {
  10.         cout << "Please write an even number.\n";
  11.         cin >> n;
  12.     }
  13.  
  14.     cout << "The number is: " << abs(n) << endl;
  15.     return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement