Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Program Lab8_22; uses crt;
- var x,count_1,count_2,max,error:integer;
- st:string;
- f:text;
- Begin clrscr;
- Assign(F,'Number.txt');
- Reset(F);
- Max:=0;
- Count_1:=0;
- Count_2:=0;
- While ((not Eof(F)) or (Count_1 < 1000)) do
- Begin
- Inc(Count_1);
- Readln(F,St);
- Val(St,X,Error);
- if (X > 30000) then halt;
- if (Abs(X) mod 10) = 1 then
- Begin
- if (Max < X) then Max:=X;
- Inc(Count_2);
- end;
- end;
- Close(F);
- Write('--------------------------------------------------------------------------------');
- if (Count_2 <> 0) then Writeln(' Ответ: ', Max)
- else Writeln(' Чисел оканчивающихся на 1 нет!');
- Write('--------------------------------------------------------------------------------');
- GotoXY(15,WhereY); Writeln('Для выхода из программы нажмите клавишу "Enter"');
- Write('--------------------------------------------------------------------------------');
- Readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement