Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace cheroke_Pinna
- {
- class Program
- {
- static void Main(string[] args)
- {
- int su, cn, conta=0; // su scelta utente / cn casual number
- Random r = new Random();
- cn = r.Next(1, 11);
- Console.WriteLine("prova a indovinare il mio numero da 1 a 10, però hai solo 3 tentativi");
- do
- {
- su = Convert.ToInt16(Console.ReadLine());
- if (su == cn)
- {
- conta = 3;
- Console.WriteLine("Hai Vinto");
- }
- else
- {
- conta++;
- if (su < cn)
- {
- Console.WriteLine("il numero da indovinare è più grande");
- }
- else
- {
- Console.WriteLine("il numero da indovinare è più piccolo");
- }
- }
- }
- while (conta < 3);
- Console.WriteLine("il numero era "+ su);
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement