Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 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 cheroke_Pinna
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int su, cn, conta=0; // su scelta utente / cn casual number
  14. Random r = new Random();
  15. cn = r.Next(1, 11);
  16.  
  17. Console.WriteLine("prova a indovinare il mio numero da 1 a 10, però hai solo 3 tentativi");
  18. do
  19. {
  20. su = Convert.ToInt16(Console.ReadLine());
  21. if (su == cn)
  22. {
  23. conta = 3;
  24. Console.WriteLine("Hai Vinto");
  25. }
  26. else
  27. {
  28. conta++;
  29. if (su < cn)
  30. {
  31. Console.WriteLine("il numero da indovinare è più grande");
  32. }
  33. else
  34. {
  35. Console.WriteLine("il numero da indovinare è più piccolo");
  36. }
  37. }
  38. }
  39. while (conta < 3);
  40. Console.WriteLine("il numero era "+ su);
  41. Console.ReadLine();
  42.  
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement