Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

YearsInRange

program YearsInRange;

uses sysutils;

var
  lowerLim, upperLim, yearCount, digitCount1, digitCount2: integer;
  repeatedDigit: boolean;

begin
  writeln('Enter lower year limit:');
  readln(lowerLim);
  writeln('Enter upper year limit:');
  readln(upperLim);
  for yearCount := lowerLim to upperLim do
    begin
      repeatedDigit := false;
      for digitCount1 := 1 to length(inttostr(yearCount)) do
        begin
          for digitCount2 := 1 to length(inttostr(yearCount)) do
            begin
              if (digitCount1 <> digitCount2) and ((inttostr(yearCount))[digitCount1] = (inttostr(yearCount))[digitCount2]) then
                repeatedDigit := true;
            end;
        end;
      if repeatedDigit then
        writeln(inttostr(yearCount));
    end;
  readln;
end.

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.