Advertisement
ZhilinskiyG

задача с зачёта

May 15th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. using namespace std;
  4.  
  5.  
  6.  int main()
  7.  {
  8.      setlocale(LC_ALL, "RUS");
  9.      int k;
  10.      cin >> k;
  11.      while (k != 0){
  12.          if (k % 3 == 0){
  13.              cout << "Прямо ";
  14.          }else{
  15.              if (k % 3 == 1){
  16.                  cout << "Влево ";
  17.              } else{
  18.                  if (k % 3 == 2){
  19.                      cout << "Вправо ";
  20.                  }
  21.              }
  22.          }
  23.          k = k / 3;
  24.      }
  25.  return 0;
  26.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement