Advertisement
thienlang

olympic

Oct 12th, 2013
451
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n;
  8.     string str;
  9.     int temp;
  10.     int i = 0;
  11.     do
  12.     {
  13.         str ="";
  14.         cin >> n;
  15.         if ( n == 0 )
  16.             return 0;
  17.  
  18.         n = 3 * n;
  19.  
  20.         //****n2***
  21.         if ( n % 2 == 0 )
  22.         {
  23.             str = "even";
  24.             temp = n/2;
  25.         }
  26.         else
  27.         {
  28.             str = "odd";
  29.             temp = (n+1 )/2;
  30.         }
  31.         //****n3********
  32.         temp = 3 * temp;
  33.  
  34.         //*****n4*******
  35.  
  36.         temp = temp /9;
  37.         i++;
  38.         cout << i << ". " << str <<" " << temp << endl;
  39.  
  40.  
  41.     }
  42.     while ( n != 0);
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement