Advertisement
LordKusa

Verificar numero primo

Jul 28th, 2019
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.29 KB | None | 0 0
  1. Function primo(numero:integer):boolean;
  2.     Var
  3.         I, cont:Integer;
  4.        
  5.     Begin
  6.         I := 0;
  7.         cont := 1;
  8.         while(I<3) and (numero <> cont)do
  9.             begin
  10.                 If((numero mod cont)=0)Then
  11.                     I := I+1;
  12.                 cont := cont + 1;
  13.             end;
  14.         If(I=2)Then
  15.             primo := true
  16.         else
  17.             primo := false;
  18.     End;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement