116 lines
2.7 KiB
C#
116 lines
2.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace ConsoleApp1
|
|
{
|
|
class Program
|
|
{
|
|
static void Feladat1()
|
|
{
|
|
int szum = 0;
|
|
int[] tomb = {1,2,3,4,5,6,7,8,9,0,0};
|
|
int n = tomb.Length;
|
|
for (int i = 0; i < n; ++i)
|
|
{
|
|
szum += tomb[i];
|
|
}
|
|
Console.WriteLine($"A tömb összege: {szum}");
|
|
}
|
|
|
|
static void Feladat2()
|
|
{
|
|
int[] tomb = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0 };
|
|
int n = tomb.Length;
|
|
int db = 0;
|
|
for (int i = 0; i < n; ++i)
|
|
{
|
|
if (tomb[i] < 5)
|
|
{
|
|
++db;
|
|
}
|
|
}
|
|
Console.WriteLine($"Darabszám: {db}");
|
|
}
|
|
|
|
static void Feladat3()
|
|
{
|
|
int[] tomb = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0 };
|
|
int n = tomb.Length;
|
|
bool van = false;
|
|
|
|
for (int i = 0; i < n; ++i)
|
|
{
|
|
if (tomb[i] == 5)
|
|
{
|
|
van = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
Console.WriteLine($"Van? : {van}");
|
|
}
|
|
|
|
static void Feladat4()
|
|
{
|
|
int[] tomb = { };
|
|
Random random = new Random();
|
|
for (int i = 0; i < 10; ++i)
|
|
{
|
|
tomb = tomb.Append(random.Next(1,7)).ToArray();
|
|
}
|
|
|
|
bool van = false;
|
|
int n = tomb.Length;
|
|
|
|
for (int i = 0; i < n; ++i)
|
|
{
|
|
if (tomb[i] == 6)
|
|
{
|
|
van = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
Console.WriteLine($"Van? : {van}");
|
|
|
|
for (int i = 0; i < n; ++i)
|
|
{
|
|
Console.WriteLine(tomb[i]);
|
|
}
|
|
}
|
|
|
|
static void Feladat5()
|
|
{
|
|
Console.WriteLine("Adj egy szót!");
|
|
string str = Console.ReadLine();
|
|
bool vanmaganhangzo = false;
|
|
List<char> maganhangzok = new List<char>();
|
|
|
|
maganhangzok.Add('a');
|
|
maganhangzok.Add('e');
|
|
maganhangzok.Add('i');
|
|
maganhangzok.Add('o');
|
|
maganhangzok.Add('u');
|
|
|
|
foreach (char c in str)
|
|
{
|
|
if (maganhangzok.Contains(c))
|
|
{
|
|
vanmaganhangzo = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
Console.WriteLine($"Van: {vanmaganhangzo}");
|
|
}
|
|
static void Main(string[] args)
|
|
{
|
|
Feladat5();
|
|
Console.ReadLine();
|
|
}
|
|
}
|
|
}
|
|
|