Skip to content

Instantly share code, notes, and snippets.

@dretax
Last active October 7, 2016 09:17
Show Gist options
  • Save dretax/8116081be3f95b109c5260ac9951656a to your computer and use it in GitHub Desktop.
Save dretax/8116081be3f95b109c5260ac9951656a to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace iziprogzh3
{
internal class Program
{
internal static string[] list = new string[] { "alma", "narancs", "barack"};
internal static void Main(string[] args)
{
Console.WriteLine("Kérem a jelszót.");
string data = Console.ReadLine();
while (!list.Contains(data))
{
Console.WriteLine("Hibás jelszó! Írj be egy újat, ha nem tudod zárd be a programot.");
data = Console.ReadLine();
}
Console.WriteLine("Írj be egy számot.");
data = Console.ReadLine();
int szam;
while(!int.TryParse(data, out szam))
{
Console.WriteLine("A beírt adat nem szám, írj be egy SZÁMOT!");
data = Console.ReadLine();
int.TryParse(data, out szam);
}
int i = 0;
while (i*i < szam)
{
i++;
//continue;
}
Console.WriteLine("A szám gyöke " + (i-1) + " és " + i + "közt van");
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment