Advertisement
aurimas12

Untitled

Mar 20th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.29 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Atspejimai
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int kart = 10;
  14.             int yes = 0;
  15.             int no = 0;
  16.  
  17.             int rez1 = 0;
  18.  
  19.             Random rnd = new Random();
  20.             Console.WriteLine("Atspek skaiciu!");
  21.             for (int i = 1; i <=kart; i++)
  22.             {
  23.                
  24.                     int sk = rnd.Next(1, 1);
  25.                     Console.WriteLine("Tavo " + i +" spejimas");
  26.                     int input = int.Parse(Console.ReadLine());
  27.                    
  28.                     if (input == sk)
  29.                     {
  30.                         yes += 1;
  31.                         rez1 += 1;
  32.                     }
  33.                     else if (input != sk)
  34.                     {
  35.                         no += 1;
  36.                         rez1 = 0;
  37.                     }
  38.                     if (rez1 == 2)
  39.                     {
  40.                         kart += 1;
  41.                         rez1 = 0;
  42.                     }
  43.             }
  44.             Console.WriteLine("yes " + yes + " no " + no );                        
  45.             Console.ReadLine();  
  46.         }
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement