zax2002

nums

Oct 20th, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.92 KB | None | 0 0
  1. uses crt;
  2. var
  3.     a,b,f:integer;
  4.     c:string;
  5. begin
  6.     //Значение переменной a не было объявлено
  7.     a := 0;
  8.    
  9.     textcolor(white);
  10.     Write('Введите ');
  11.     textcolor(yellow);
  12.     write ('МАКСИМАЛЬНОЕ');
  13.     textcolor(white);
  14.     writeln(' значение: ');
  15.     textcolor(green);
  16.     readln(b);
  17.     textcolor(white);
  18.     write('Введите ');
  19.     textcolor(yellow);
  20.     write ('ТИП ');
  21.     textcolor(white);
  22.     write('чисел ');
  23.     textcolor(red);
  24.     writeln('(чётн\нечётн):');
  25.     textcolor(green);
  26.     read(c);
  27.     b:=b-1;
  28.     if c = 'чётн' then f:= 0;
  29.     if c = 'нечётн' then f:= 1;
  30.     while a <=b do begin;
  31.         a:=a+1;
  32.         textcolor(yellow);
  33.         //Pascal это не JS, чтобы складывать строки плюсиком
  34.         if a mod 2 = f then write(a, '; ');
  35.     end;
  36.     textcolor(green);
  37.     writeln('');
  38.     writeln('Все числа выведены.');
  39.     textcolor(lightgray);
  40. end.
Advertisement
Add Comment
Please, Sign In to add comment