The_Law

Untitled

Dec 13th, 2017
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.32 KB | None | 0 0
  1. program ideone;
  2.  
  3. var
  4. c: char = ',';
  5. sum, cnt: integer;
  6.  
  7. begin
  8.     sum := 0;
  9.     cnt := 0;
  10.  
  11.     while c <> '.' do
  12.     begin
  13.         if (ord('0') <= ord(c)) and (ord(c) <= ord('9')) then
  14.             sum := sum + ord(c) - ord('0');
  15.         cnt := cnt + 1;
  16.         read(c);
  17.     end;
  18.    
  19.     if cnt - 1 = sum then
  20.         writeln(True)
  21.     else
  22.         writeln(False);
  23.    
  24. end.
Advertisement
Add Comment
Please, Sign In to add comment