Facebook
From Hot Coyote, 3 Years ago, written in C#.
Embed
Download Paste or View Raw
Hits: 90
  1. class Program
  2.     {
  3.         static void Main(string[] args)
  4.         {
  5.             #region zad0
  6.             int n = 0;
  7.             int suma = 0;
  8.             Console.WriteLine("Zadannie0");
  9.             Console.WriteLine("Podaj liczbę");
  10.             n = int.Parse(Console.ReadLine());
  11.  
  12.             while (suma < n)
  13.             {
  14.                 suma = suma + 1;
  15.                 Console.WriteLine(suma + "\n");
  16.             }
  17.             #endregion
  18.  
  19.             #region zad1
  20.             //char wybor = 'a';
  21.             //Console.WriteLine("Zadanie 1" + "\n");
  22.             //Console.WriteLine("Podaj litere podpunktu od a do e");
  23.             //wybor = char.Parse(Console.ReadLine());
  24.             //int n = 0;
  25.             //switch (wybor)
  26.             //{
  27.             //    case 'a':
  28.             //    Console.WriteLine("Podaj liczbę");
  29.             //    n = int.Parse(Console.ReadLine());
  30.  
  31.             //        for (int i = 0; i <= n; i++)
  32.             //        {
  33.             //            int suma = 0;
  34.             //            Console.WriteLine(suma + i + "\n");
  35.             //        }
  36.             //    break;
  37.  
  38.             //    case 'b':
  39.  
  40.             //        Console.WriteLine("Podaj liczbę");
  41.             //        n = int.Parse(Console.ReadLine());
  42.  
  43.             //        for (int i = 0; i <= n; i++)
  44.             //        {
  45.             //            int suma = 0;
  46.             //            Console.WriteLine(suma + (2 * i - 1) + "\n");
  47.             //        }
  48.             //        break;
  49.  
  50.             //    case 'c':
  51.             //        Console.WriteLine("Podaj liczbę");
  52.             //        n = int.Parse(Console.ReadLine());
  53.  
  54.             //        for (int i = 0; i <= n; i++)
  55.             //        {
  56.             //            int suma = 0;
  57.             //            Console.WriteLine(suma + Math.Pow(2, i - 1) + "\n");
  58.             //        }
  59.             //        break;
  60.  
  61.             //    case 'd':
  62.             //        Console.WriteLine("Podaj liczbę");
  63.             //        n = int.Parse(Console.ReadLine());
  64.  
  65.             //        for (int i = 0; i <= n; i++)
  66.             //        {
  67.             //            int suma = 0;
  68.             //            Console.WriteLine(suma + i + Math.Pow(-1, i) + "\n");
  69.             //        }
  70.             //        break;
  71.  
  72.             //    case 'e':
  73.             //        Console.WriteLine("Podaj liczbę");
  74.             //        n = int.Parse(Console.ReadLine());
  75.  
  76.             //        for (int i = 0; i <= n; i++)
  77.             //        {
  78.             //            int suma = 0;
  79.             //            Console.WriteLine(suma + i + Math.Pow(-1, i + 1) + "\n");
  80.             //        }
  81.             //        break;
  82.             //}
  83.  
  84.             #endregion
  85.  
  86.             #region zad2
  87.  
  88.             //char wybor = 'A';
  89.             //Console.WriteLine("Zadanie2" + "\n" + "Wybierz podpunk a,b lub c");
  90.             //wybor = char.Parse(Console.ReadLine());
  91.  
  92.             //switch (wybor)
  93.             //{
  94.             //    case 'a':
  95.             //        Program.Figurya();
  96.  
  97.             //        break;
  98.  
  99.             //    case 'b':
  100.             //        Program.Figuryb();
  101.             //        break;
  102.  
  103.             //    case 'c':
  104.             //        Program.Figuryc();
  105.             //        break;
  106.  
  107.             //    default:
  108.             //        break;
  109.             //}
  110.  
  111.  
  112.             #endregion
  113.  
  114.             #region zad3
  115.  
  116.             //Console.WriteLine("Zadanie 3" + "\n");
  117.             //char wybor3 = 'a';
  118.             //Console.WriteLine("na petli: " + "\n" + "for - kliknij a" + "\n" + "while - kliknij b" + "\n");
  119.             //wybor3 = char.Parse(Console.ReadLine());
  120.  
  121.             //int n;
  122.             //switch (wybor3)
  123.             //{
  124.  
  125.             //    case 'a':
  126.             //        Console.WriteLine("Podaj rozmiar tabliczki n: (1, 2, 3, ..)" + "\n");
  127.             //        n = int.Parse(Console.ReadLine());
  128.             //        for (int i = 0; i <= n; i++)
  129.             //        {
  130.             //            Console.Write(i + "\t");
  131.             //            for (int j = 1; j <= n; j++)
  132.             //            {
  133.             //                if (i > 0) Console.Write(i * j + "\t");
  134.             //                else Console.Write(j + "\t");
  135.             //            }
  136.             //            Console.Write("\n");
  137.             //        }
  138.             //        break;
  139.  
  140.             //    case 'b':
  141.             //        Console.WriteLine("Podaj rozmiar tabliczki n: (1, 2, 3, ..)" + "\n");
  142.             //        n = int.Parse(Console.ReadLine());
  143.  
  144.  
  145.             //        int ib = 1;
  146.             //        int jb = 1;
  147.  
  148.             //        while(ib <= n)
  149.             //        {
  150.  
  151.             //            Console.Write(ib + "\t");
  152.             //            while(jb <= n)
  153.             //            {
  154.  
  155.             //                if (ib > 0)
  156.             //                {
  157.  
  158.             //                    Console.Write(ib * jb + "\t");
  159.             //                }
  160.             //                else
  161.             //                {
  162.             //                    Console.Write(jb + "\t");
  163.             //                }
  164.  
  165.             //                jb++;
  166.             //            }
  167.  
  168.             //            Console.Write("\n");
  169.  
  170.             //            ib++;
  171.             //        }
  172.             //        break;
  173.  
  174.             //    default:
  175.             //        break;
  176.             //}
  177.  
  178.             #endregion
  179.         }
  180.  
  181.         static void Figurya()
  182.         {
  183.            
  184.             for (int n = 0; n < 3; n++)
  185.             {
  186.                 Console.WriteLine(new String('X', n + 1));
  187.  
  188.  
  189.             }
  190.            
  191.         }
  192.  
  193.         static void Figuryb()
  194.         {
  195.             for (int n = 0; n < 3; n++)
  196.             {
  197.                 Console.WriteLine(new String('#', n + 1).PadLeft(3, ' '));
  198.             }
  199.         }
  200.  
  201.         static void Figuryc()
  202.         {
  203.             int miejsce, liczba;
  204.             for (int i = 1; i <= 3; i++)  
  205.             {
  206.                 for (miejsce = 1; miejsce <= (3 - i); miejsce++)
  207.                     Console.Write(" ");
  208.                 for (liczba = 1; liczba <= i; liczba++)
  209.                     Console.Write('&');
  210.                 for (liczba = (i - 1); liczba >= 1; liczba--)
  211.                     Console.Write('&');
  212.                 Console.WriteLine();
  213.             }
  214.         }
  215.        
  216.     }