Advertisement
clintv

Ada 001 - Lesson 1 - Your First Ada Program

Aug 2nd, 2020 (edited)
3,566
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ada 0.53 KB | None | 0 0
  1. with Ada.Text_IO;
  2.  
  3. procedure Hello is
  4.    A, B, C : Integer;
  5.    
  6. begin
  7.    Ada.Text_IO.Put_Line ("Enter first number:");
  8.    A := Integer'Value (Ada.Text_IO.Get_Line);
  9.    Ada.Text_IO.Put_Line ("Enter second number:");
  10.    B := Integer'Value (Ada.Text_IO.Get_Line);
  11.    C := A + B;
  12.    
  13.    if C = 0 then
  14.       Ada.Text_IO.Put_Line ("RESULT IS 0");
  15.    elsif C > 0 then
  16.       Ada.Text_IO.Put_Line ("Result is + :" & Integer'Image (C));
  17.    else
  18.       Ada.Text_IO.Put_Line ("Result is - :" & Integer'Image (C));
  19.    end if;
  20. end Hello;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement