xxxxxxxxxx
// You will get everything needed here
// https://github.com/jashkenas/coffeescript/wiki/List-of-languages-that-compile-to-JS
xxxxxxxxxx
bool hasDuplicates(int [] arr) {
for (int i = 0; i < arr.Length; i++)
{
for (int j = i+1; j < arr.Length; j++)
{
if(arr[i]==arr[j])
{
return true;
}
}
}
return false;
}
int []inputArray ={ 1, 2, 3, 3 };
var a= hasDuplicates(inputArray);
Console.WriteLine(a);
xxxxxxxxxx
using System;
public class Tarea
{
public static void Main(string[] args)
{
Ejercicio5();
}
public static void Ejercicio5()
{
// var seed = Environment.TickCount;
var random = new Random();
int num1 = random.Next(1,15);
int num2 = random.Next(1,15);
int num3 = random.Next(1,15);
int[] ingreso = new int[6];
int aciertos=0;
for(int i=0;i<6;i++)
{
Console.WriteLine($"Intento {i+1} - Adivine el numero: ");
ingreso[i] = Int32.Parse(Console.ReadLine());
if(ingreso[i]==num1 ^ ingreso[i]==num2 ^ ingreso[i]==num3)
{
aciertos++;
}
}
if(aciertos>=2)
Console.WriteLine("Ganaste!");
else
Console.WriteLine("Perdiste!");
Console.WriteLine($"\nAdivinaste {aciertos} de los 3 numeros!");
}
}
xxxxxxxxxx
namespace BartenderApp.Models
{
public class Drink
{
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public decimal Price { get; set; }
}
}