using System;
namespace Bartosz_Laskowski_Kolokwium_2
{
class Program
{
static int dziel(int n)
{
for (int i = 1; i <= n; i++)
{
if (n % i == 0)
{
Console.WriteLine(i);
}
}
return 0;
}
static bool pier(int n)
{
bool test=false;
for(int i=2; i<n-1; i++)
{
if(n%i==0)
{
test=true;
}
}
if(test==true)
{
return true;
}
else
{
return false;
}
}
static void Main(string[] args)
{
Console.WriteLine("Program zrealizował Bartosz Laskowski");
uint wybor = 0;
do
{
wybor = 0;
Console.WriteLine("1. Test metod");
Console.WriteLine("2. Odczyt pliku i działanie");
Console.WriteLine("3. Koniec");
do
{
Console.WriteLine("Wybierz opcję:");
if (uint.TryParse(Console.ReadLine(), out wybor)) ;
else
{
Console.WriteLine("Podaj wartość liczbową");
}
}
while (wybor > 3 || wybor < 1);
switch (wybor)
{
case 1:
int n;
bool test = false;
Console.WriteLine("\nPodaj liczbę naturalną");
n = int.Parse(Console.ReadLine());
Console.WriteLine("Twoja liczba to: {0}", n);
Console.WriteLine("Dzielniki twojej liczby to: ");
dziel(n);
if(pier(n)==true)
{
Console.WriteLine("Twoja liczba nie jest pierwsza");
}
else
{
Console.WriteLine("Twoja liczba jest pierwsza");
}
break;
case 2:
string text = System.IO.File.ReadAllText(@"C:\Users\barte\source\repos\Bartosz Laskowski Kolokwium 2\hasla.txt");
Console.WriteLine(text);
int ilosca = 0;
for (int i = 0; i < text.Length; i++)
{
if (text[i].CompareTo('a') == 0)
{
ilosca++;
}
}
Console.WriteLine("Ilość litery a w tym tekscie to {0}", ilosca);
break;
case 3:
Console.WriteLine("Dziękuje za skorzystanie z programu");
break;
default:
Console.WriteLine("Nie wybrałeś żadnej opcji. Spróbuj ponownie");
break;
}
}
while (wybor != 3);
}
}
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}