Advertisement
Guest User

weqARTSZDFUIGOHJKPŐÉLÚÁ

a guest
Nov 18th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.53 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 ConsoleApp1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             // 1. feladat
  14.             Console.Write("Adja meg hány ember adatát mérte fel : ");
  15.             int elemszam;
  16.             elemszam = Convert.ToInt32(Console.ReadLine());
  17.             // 2. feladat
  18.             string[] tomb = new string[elemszam];
  19.  
  20.             // 3. feladat
  21.             for (int i = 0; i < tomb.Length; i++)
  22.             {
  23.                 Console.Write("Adja meg a következő ember nemzetiségét : ");
  24.                 tomb[i] = Console.ReadLine();
  25.             }
  26.  
  27.             // 4. feladat
  28.             int nulla = 0;
  29.             for (int i = 0; i < tomb.Length; i++)
  30.             {
  31.                 if (tomb[i] == "")
  32.                 {
  33.                     nulla++;
  34.                 }
  35.             }
  36.  
  37.             Console.WriteLine();
  38.             // 6. feladat
  39.             for (int i = 0; i < tomb.Length; i++)
  40.             {
  41.                 if (tomb[i] == "olasz")
  42.                 {
  43.                     // 7. feladat
  44.                     Console.WriteLine("Van olasz");
  45.                     break;
  46.                 }
  47.                 else
  48.                 {
  49.                     Console.WriteLine("Nincs olasz");
  50.                 }
  51.             }
  52.  
  53.             // 5. feladat
  54.             Console.WriteLine(nulla + " ember volt aki nem adta meg a nemzetiségét.");
  55.         }
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement