Advertisement
Guest User

Untitled

a guest
Jan 25th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.03 KB | None | 0 0
  1. static void Main(string[] args)
  2.         {
  3.             //Števci za x,y,z in w pri izpisovanju številk
  4.             int x = 0;
  5.             int y = 0;
  6.             int z = 0;
  7.             int w = 0;
  8.             //Števci za kolikokrat po vrsti izpiše določeno število na določeni poziciji
  9.             int steveczaW = 0;
  10.             int steveczaZ = 0;
  11.             int steveczaY = 0;
  12.             int steveczaX = 0;
  13.  
  14.             //Števec za kolikšna je vrstica pri podvajanju z 16
  15.             int koliksnatamocna = 1;
  16.          
  17.             for (int steveczaVRSTICE = 0; steveczaVRSTICE <= 144; steveczaVRSTICE++)
  18.  {
  19.                 //Začne znova ko konča prve kombinacije
  20.                 if (steveczaVRSTICE == 16 * koliksnatamocna)
  21.                 {
  22.                      x = koliksnatamocna;
  23.                      y = koliksnatamocna;
  24.                      z = koliksnatamocna;
  25.                      w = koliksnatamocna;
  26.  
  27.                      steveczaW = 0;
  28.                      steveczaZ = 0;
  29.                      steveczaY = 0;
  30.                      steveczaX = 0;
  31.                
  32.                 }
  33.  
  34.                 //Začne znova ko konča prve kombinacije
  35.                 if (steveczaW == 0 && steveczaVRSTICE != 0  || steveczaW == 1 )
  36.                 {
  37.  
  38.                     if (steveczaVRSTICE % 16 == 0)
  39.                     {
  40.                         koliksnatamocna = koliksnatamocna + 1;
  41.                     }
  42.  
  43.                     if (steveczaW == 1)
  44.                     {
  45.  
  46.                         if (steveczaVRSTICE != 16 * koliksnatamocna)
  47.                         {
  48.                             w = w - 1;
  49.                         }
  50.                         steveczaW = 0;
  51.  
  52.                     }
  53.                     else
  54.                     {
  55.                        
  56.                             w = w + 1;
  57.                             steveczaW = 1;
  58.  
  59.                     }
  60.                 }
  61.  
  62.                 if (steveczaZ == 2 || steveczaZ == 4)
  63.                 {
  64.                     if (steveczaZ == 4)
  65.                     {
  66.                         if (steveczaVRSTICE != 16 * koliksnatamocna)
  67.                         {
  68.                             z = z - 1;
  69.                         }
  70.                         steveczaZ = 0;
  71.                     }
  72.                     else
  73.                     {
  74.                         z = z + 1;
  75.                     }
  76.                 }
  77.  
  78.                 if (steveczaY == 4 || steveczaY == 8)
  79.                 {
  80.                     if (steveczaY == 8)
  81.                     {
  82.                         if (steveczaVRSTICE != 16 * koliksnatamocna)
  83.                         {
  84.                             y = y - 1;
  85.                         }
  86.                         steveczaY = 0;
  87.                     }
  88.                     else
  89.                     {
  90.                         y = y + 1;
  91.                     }
  92.                 }
  93.  
  94.                 if (steveczaX == 8)
  95.                 {
  96.                     x = x + 1;
  97.                     steveczaX = 0;
  98.                 }
  99.  
  100.                 //Izračun po njegovi ideji
  101.                 int a = z;
  102.                 int b = ((w + x) / 11);
  103.                 int c = ((x + y) / 11);
  104.                 int d = ((y + z) / 11);
  105.  
  106.                 //Izračun po njegovi ideji s preverjanjem ali je to možno
  107.                 if (Convert.ToInt32(w + x) >= 10 && Convert.ToInt32(w + x) / 11 != 10)
  108.                 {
  109.                     Console.WriteLine($"{a}{b}{c}{d}");
  110.                 }
  111.  
  112.                 if (Convert.ToInt32(x + y) >= 10 && Convert.ToInt32(x + y) / 11 != 10)
  113.                 {
  114.                    Console.WriteLine($"{a}{b}{c}{d}");
  115.                 }
  116.  
  117.                 if (Convert.ToInt32(y + z) >= 10 && Convert.ToInt32(y + z) / 11 != 10)
  118.                 {
  119.                     Console.WriteLine($"{a}{b}{c}{d}");
  120.                 }
  121.  
  122.                 //Dodajanje stevcem stevilo 1
  123.                 steveczaX = steveczaX + 1;
  124.                 steveczaY = steveczaY + 1;
  125.                 steveczaZ = steveczaZ + 1;
  126.  
  127.             }
  128.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement