varios

Programa Olá Mundo

program OlaMundo;

begin

 WriteLn('Olá, Mundo!');

end.

 

Números perfeitos

program numerosPerfeitos;

 

uses crt;

 

var

 ate, x, soma, i: integer;

 

begin

 clrscr;

 x := 0;

 writeln('Numeros perfeitos abaixo de');

 Readln(ate);

 repeat

  x := x + 1;

  soma := 0;

  for i := 1 to x - 1 do

  begin

 if x mod i = 0 then

 soma := soma + i;

  end;

  if soma = x then

  begin

 writeln(x);

  end;

 until (x > ate);

 writeln('Pressione qualquer tecla para finalizar…');

 readkey;

end.

 

Repetição

Soma dos números pares.

 program Soma_Pares;

 uses crt;

 var

  superior, soma, num: integer;

 begin

  soma:=0;

  write ('Entre com o limite superior');

  readln (superior);

  num:=2;

 

  repeat

 soma:=soma+num;

 num:=num+2;

  until (num > superior);

 

  writeln('A soma dos números pares de 2 até ', superior,' é ', soma);

  readln;

 end.

 

Números pares entre dois valores inteiros

program pares;

var

 x, y: integer;

begin

 writeln('Digite os dois valores');

 readln(x, y);

 if (x mod 2)<> 0 then

  x := x + 1;

 while x<= y do

 begin

  writeln(x, ' - ');

  x := x + 2;

 end;

 writeln('Fim da Lista');

end.

 

Teste lógico

program Teste;

var

 a, b: integer;

begin

  writeln('Digite um número para A');

  readln(a);

  writeln('Digite o número para B');

  readln(b);

 if (a > b) then { Se A é maior que B então }

    writeln('A é maior que B')

    else { Senão… }

 if (a< b) then

    writeln('B é maior que A')

    else

  writeln('B é igual à A');

 end.

Sondagem

Avalia o Site

Optimo (110)
61%

Muito Bom (32)
18%

Bom (14)
8%

Regular (13)
7%

Mao (10)
6%

Total de votos: 179