|
more than 450 programs for free
|
![]() English |
![]() Slovensky |
![]() Česky |
![]() Šarišsky |
|
Category: Homework in Pascal Author: Pavel Paták web: www.webpark.cz/programar Program: Prvocislo.pas File exe: Prvocislo.exe Zjistí, zda je zadané číslo prvočíslem
Views: 1013x
{ PRVOCISLO.PAS Copyright (c) Pavel Patak } { Zjisti, zda je zadane cislo prvocislem } { } { Datum:28.10.2004 http://www.trsek.com } Program Prvocislo; Var P,I : Integer; Delitelu : Integer; Begin Write('Zadej cislo : '); Readln(P); Delitelu:=0; Writeln; For I:=2 to Trunc(Sqrt(p)) do {Hledame delitele} if P mod I = 0 then Delitelu:=Delitelu+1; if (Delitelu = 0) and (P>1) then Writeln('Je to prvocislo.') else Writeln('Neni to prvocislo.'); {Cislo mensi nez 2 nemuze byt prvocislem, bez ohledu na pocet delitelu} Readln; End. [Run] [Save] [Print] [Send e-mail] |
|