Var s: string; I,n,k,L:longint; Begin Readln(s); L:=length(s); If s[1]<>'-' then begin For i:=1 to L do If s[i] in ['1'...'9'] or (s[i]='.' and s[i+1]<>'.') then inc(k); If k<>L then writeln('слово') else writeln('число'); End else begin For i:=2 to L do If (s[i] in ['1'...'9']) or (s[i]='.' and s[i+1]<>'.')then inc(k); If k<>(L-1) then writeln('слово') else writeln('число'); End; End.
Вот тебе простой вариант ришение задачи (коментар=пояснение)
PascalВыделить код
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 program prg; uses crt; var rez,chislo,min,max:integer; begin Write('Enter number = ');readln(chislo); //zanosim 1 chislo max:=chislo; //v max ta min min:=chislo; //chtobu potom mu soukb sravnivat s drugimi chislamu while (chislo<>0) do //zapuskaem zikl poka mu ne napishem 0 begin if (chislo>max)then max:=chislo; //sravnivaem s max if (chislo<min) then min:=chislo; //sravnivaem s min readln(chislo); //snova pihem chislo end; rez:=(max-min); //nahodim raznizy writeln('max(',max,') - min(',min,') = ',rez); //otvet end.
Const n=12; m=10; var a:array[1..n,1..m] of integer; i,j,k:integer; begin k:=0; for j:=1 to m do for i:=n downto 1 do begin k:=k+1; a[i,j]:=k; end; for i:=1 to n do begin for j:=1 to m do write(a[i,j]:4); writeln; end; end.
Внимание! Если программа не работает, обновите версию!
begin
var r:real;
real.TryParse(ReadlnString,r).Println
end.
Примеры
-345.432
True
+253432
True
1.52e-14
True
15,3
False