Advertisement
basilkot

Untitled

Nov 28th, 2022
1,327
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.36 KB | None | 0 0
  1. Program Task2(output);
  2.     var odd, even, val: longint;
  3. begin
  4.     odd := 0;
  5.     even := 0;
  6.  
  7.     readln(val);
  8.  
  9.     while val > 0 do
  10.         begin
  11.             if val mod 2 = 0 then
  12.                 even := even + 1
  13.             else
  14.                 odd := odd + 1;
  15.             val := val div 10;
  16.         end;
  17.    
  18.     writeln(even);
  19.     writeln(odd)
  20. end.
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement