ONLINE COMPILERS
LIBRARY
MANUAL PAGES & DOCS
CONTACT
Latest Users' Questions
User Submitted Source Code!
Description:
sara
Language: PASCAL
Code:
sara
Language: PASCAL
Code:
program adivinha;
uses crt,dos;
var n:integer;
ns:integer;
tent:integer;
ac:boolean;
Begin
RANDOMIZE;
NS:=RANDOM(100)+1;
ac:=false;
tent:=1;
while((tent<=7)and(not ac))do
begin
repeat
write(tent,'a tentativa:');
readln(n);
until((n>=1)and(n<=100));
if (n=ns)then
ac:=true
else
if(n<ns) then
writeln('errou... o numero e maior')
else
writeln('errou... o numero e menor');
tent:=tent+1;
end;
if(ac) then
writeln ('Parabens! Acertou no numero',ns,'em',tent,'tentativas')
else
writeln('esgotou as tentativas... o numero secreto era o', ns);
readln;
End.
uses crt,dos;
var n:integer;
ns:integer;
tent:integer;
ac:boolean;
Begin
RANDOMIZE;
NS:=RANDOM(100)+1;
ac:=false;
tent:=1;
while((tent<=7)and(not ac))do
begin
repeat
write(tent,'a tentativa:');
readln(n);
until((n>=1)and(n<=100));
if (n=ns)then
ac:=true
else
if(n<ns) then
writeln('errou... o numero e maior')
else
writeln('errou... o numero e menor');
tent:=tent+1;
end;
if(ac) then
writeln ('Parabens! Acertou no numero',ns,'em',tent,'tentativas')
else
writeln('esgotou as tentativas... o numero secreto era o', ns);
readln;
End.
Comments: