Advertisement
jusapi

Untitled

Aug 18th, 2022
1,255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.37 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 Arrays02
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string[] arrayProductosMarket;
  14.             int cantProdMarket;
  15.             Console.WriteLine("Digite la cantidad de productos del SuperMercado");
  16.             _ = int.TryParse(Console.ReadLine(), out cantProdMarket);
  17.             arrayProductosMarket = new string[cantProdMarket];
  18.             // Ciclo para llenar datos del array  
  19.             for (byte i=0; i < arrayProductosMarket.Length; i++)
  20.             {
  21.                 Console.WriteLine("Digite el nombre del producto {0}",(i+1));
  22.                 arrayProductosMarket[i] = Console.ReadLine();
  23.             }
  24.             // Ciclo para Visualizar elementos del array
  25.             Console.WriteLine("--------------------------------");
  26.             Console.WriteLine("Los productos disponibles del SuperMercado son:");
  27.             for (byte i=0; i < arrayProductosMarket.Length; i++)
  28.             {
  29.                 Console.WriteLine("Producto {0}: {1}",(i+1),arrayProductosMarket[i]);
  30.             }
  31.  
  32.  
  33.            
  34.             Console.ReadKey();
  35.  
  36.             /* Ciclo para recorrer array e indicar si un elemento existe
  37.              en el inventario del SuperMercado */
  38.         }
  39.     }
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement