Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- using System.Deployment;
- using System.Text;
- using System.Collections.Generic;
- class Sorteo
- {
- static void Main(string[] args)
- {
- int[] C = new int[10];
- Console.Write("Ingrese Indice de sorteo: ");
- int N = int.Parse(Console.ReadLine());
- string[,] entero = new string[N,5];
- for(int j=1; j<=N; j++)
- {
- var bolas = "10210231023456789102345678910234567893456789456789";
- var sorteo = new char[5];
- var bola = new Random();
- for (int i = 0; i < sorteo.Length; i++)
- {
- entero[j-1,i] = Convert.ToString(bolas[bola.Next(bolas.Length)]);
- Console.Write($"{entero[j-1,i]}");
- }
- Console.Write(" ");
- }
- Console.WriteLine();
- int max1=0; int max2=0; int[] c = new int[10];int m=0; int n=0;
- Console.ForegroundColor = ConsoleColor.Green;
- for (int r=0; r<10; r++)
- {
- for (int j=0; j<N; j++)
- {
- if (entero[j,4]==$"{r}")
- {
- ++C[r];
- }
- }
- if (max1<C[r])
- {
- max1 = C[r];
- m = r;
- }
- Console.WriteLine($"Enteros que terminan en {r} son {C[r]}");
- }
- for (int k=0; k<10; k++)
- {
- if(k==m){continue;}
- if (max2<C[k])
- {
- max2 = C[k];
- n=k;
- }
- }
- Console.WriteLine($"Terminación {m} con {max1} repeticiones.");
- Console.WriteLine($"Terminación {n} con {max2} repeticiones.");
- Console.ForegroundColor = ConsoleColor.Green;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement