rengetsu

HackerRank_ForLoop

Jun 20th, 2018
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdio>
  3. using namespace std;
  4. int main() {
  5.     int a, b;
  6.     cin >> a >> b;
  7.     for(int i = a; i < (b + 1); i++) {
  8.         if (i == 1) { cout << "one" << endl; }
  9.         else if (i == 2) { cout << "two" << endl; }
  10.         else if (i == 3) { cout << "three" << endl; }
  11.         else if (i == 4) { cout << "four" << endl; }
  12.         else if (i == 5) { cout << "five" << endl; }
  13.         else if (i == 6) { cout << "six" << endl; }
  14.         else if (i == 7) { cout << "seven" << endl; }
  15.         else if (i == 8) { cout << "eight" << endl; }
  16.         else if (i == 9) { cout << "nine" << endl; }
  17.         else if (i % 2 == 0) { cout << "even" << endl; }
  18.         else { cout << "odd" << endl; }
  19.     }
  20.     return 0;
  21. }
Add Comment
Please, Sign In to add comment