impressive_i

5 and 6 in 459...671

Aug 12th, 2019
1,249
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {Сколько чисел от 459 до 671 содержат в записи одновременно цифры 5 и 6?}
  2.  
  3. program test;
  4. //uses crt;
  5.  
  6. var num : integer;
  7.     count : integer;
  8.  
  9. function isDigitInNumber(x : integer; d : integer):boolean;
  10. var flag : boolean;
  11. begin
  12.     flag := false;
  13.     while( x > 0 ) do begin
  14.        if( x mod 10 = d ) then begin
  15.           flag := true; break;
  16.        end;
  17.        x := x div 10;
  18.     end;
  19.     result := flag;
  20. end;
  21.  
  22.  
  23. begin
  24.    count := 0;
  25.    for num := 459 to 671 do begin
  26.        if(isDigitInNumber(num, 5) and isDigitInNumber(num, 6)) then
  27.          begin
  28.           count := count + 1;
  29.           writeln(num);
  30.          end;
  31.    end;
  32.    
  33.    writeln('Количество цифр между 459 и 671,в которых есть цифры 5 и 6: ', count);
  34. end.
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×