fork download
  1.  
  2. /* Demonstrates conditionals in PL/I */
  3. COND: PROCEDURE OPTIONS(MAIN);
  4. DECLARE NUM FIXED DECIMAL(5);
  5. DECLARE MSG CHARACTER(20) VARYING;
  6.  
  7. PUT SKIP LIST('Enter a number:');
  8. GET LIST(NUM);
  9.  
  10. IF NUM > 0 THEN
  11. DO;
  12. MSG = 'Positive';
  13. PUT SKIP LIST('The number is positive.');
  14. END;
  15. ELSE IF NUM < 0 THEN
  16. MSG = 'Negative';
  17. ELSE
  18. MSG = 'Zero';
  19.  
  20. PUT SKIP LIST('Classification:', MSG);
  21. END COND;
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout