{Vzorová øešení - Pøíklady pro zaèáteèníky I
Vše uvedeno v jediném souboru, snad si to zvládnete rozdìlit sami.}


Program Nic;
{Tento program nic, ale opravdu nic nedela}

Begin
{A tudiz v teto casti neobsahuje zadne prikazy}
End.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Program Pocitani;
{Po zadani dvou èísel a,b z klavesnice program vypocte a+b,a-b,a*b,a/b, a div b, a mod b
(celociselne deleni a zbytek po nem)
Uživatel zadá dve cisla, druhe pokud mozno nenulove, nulou se totiz spatne deli}

Var a,b : Integer; {Zadane hodnoty budou celociselne}

Begin
   Write('Zadej dve nenulova cisla a, b :');    {Vyzva uzivateli, ve skutecnosti staci
							nenulove b, ale kdo se s tim ma vypisovat?}
   Readln(a,b);
   Writeln;
   Writeln(a,' + ',b,' = ',a+b); 	{Soucet}
   Writeln(a,' - ',b,' = ',a-b);	{Rozdil}
   Writeln(a,' * ',b,' = ',a*b);	{Soucin}
   Writeln(a,' / ',b,' = ',a/b);	{Podil}
   Writeln(a,' div ',b,' = ',a div b);{Celociselny podil}
   Writeln(a,' mod ',b,' = ',a mod b);{Zbytek po celociselnem deleni}
   Readln; {A zkuste to bez nej!!!}
End.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Program Spotreba;
{Po zadani ujetych kilometru a spotrebovaných litru paliva vypocte spotrebu na 100km}

Var Km, Litru : Real;

Begin
   Write('Zadej pocet ujetych kilometru : ');
   Readln(Km);
   Write('Nyni udej mnozstvi spotrebovaneho paliva v litrech : ');
   Readln(Litru);
   Writeln;
   Writeln('Spotreba vaseho automobilu cini ',Litru/KM*100:5:2,' l na 100km');
	{Pokud nechcete, aby byl vysledek udan v hnusném real-tvaru, pouzijte :
          Litru/KM*100:PocetMist:PocetDesetinnýchMíst, tedy :
   Writeln('Spotreba vaseho automobilu cini ',Litru/KM*100:5:2,' l na 100km');}
   Readln;
End.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Program BMI;
{Po zadanu vysky v cm a vahy v kg vypocte BMI index}

Var Vyska, Vaha, PomocnaPromenna : Real;

Begin
   Write('Zadej svou vysku v cm : ');
   Readln(Vyska);
   Write('Nyni udej svou vahu (v kg) : ');
   Readln(Vaha);
   Vyska:=Vyska/100; {Prevedeme na metry}
   PomocnaPromenna:=Vyska*Vyska;
   Writeln('Vase BMI je ',Vaha/PomocnaPromenna:5:2);
   Readln;
End.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Program Obdelnik;
{Po zadani delek dvou stran obdelnika vypocte obvod a obsah}

Var a, b, o, S : Real;

Begin
   Write('Zadej delku strany a : ');
   Readln(a);
   Write('Zadej delku strany b : ');
   Readln(b);
   Writeln;
   o:=2*(a+b);
   S:=a*b;
   Writeln('o = ',o:5:2);
   Writeln('S = ',S:5:2);
   Readln;
End.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Program Kvadr;
{Po zadání tri rozmeru kvadru vypocte jeho objem}

Var a, b, c, V : Real;

Begin
   Write('Zadej delku strany a : ');
   Readln(a);
   Write('Zadej delku strany b : ');
   Readln(b);
   Write('Zadej delku strany c : ');
   Readln(c);
   Writeln; {Trocha odsazeni zvetsi prehlednost}
   Writeln('V = ',a*b*c:7:2);
   Readln;
End.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Program Rychlost;
{Po zadani drahy a casu vypocte prumernou rychlost, predpoklada se s,t > 0}

Var s, t, v : Real;

Begin
   Write('Urazena draha s = ');
   Readln(s);
   Write('Potrebny cas t = ');
   Readln(t);
   Writeln;
   Writeln('Prumerna rychlost v = ',s/t:5:2);
   Readln;
End.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Program Vtipy;
{Vypise na obrazovku dva vtipy}
Uses Crt;

Begin
   ClrScr; {Se smazanou obrazovkou to naozaj vyzera krajsie}
   Writeln('Boze, proc jsi udelal zenu tak krasnou?');
   Delay(1500);
   Writeln('Abys ji chtel.');
   Delay(1000);
   Writeln('A proc jsi ji udelal tak hloupou?');
   Delay(1000);
   Writeln('Aby ona chtela tebe!');
   Delay(2000);

   ClrScr;
   Write('Vojna dela z chlapcu muze. ');
   Delay(2000);
   Write('Kulturistika z devcat.');
   Delay(2000); {Tady nahrazuje Readln}

End.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Program Kruh;
{Po zadani polomeru vypoète obvod a obsah kruhu}

Const Pi = 3.14;
Var r, o, S : Real;

Begin
   Write('Polomer kruhu r = ');
   Readln(r);
   o:= 2 * Pi * r;
   S:= Pi* r*r;

   Writeln;
   Writeln('o = ',o:5:2);
   Writeln('S = ',S:5:2);
   Readln;
End.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Program Koule;
{Po zadání polomeru vypocte povrch a objem koule}

Const Pi = 3.14;
Var r, S, V : Real;

Begin
   Write('Polomer koule r = ');
   Readln(r);
   S:= 4 * Pi * r*r;
   V:= 4/3*Pi* r*r*r;

   Writeln;
   Writeln('S = ',S:5:2);
   Writeln('V = ',V:5:2);
   Readln;
End.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx