ONLY DO WHAT ONLY YOU CAN DO

こけたら立ちなはれ 立ったら歩きなはれ

Adaで四則演算と数値の出力

Ada

with TEXT_IO, Ada.Integer_Text_IO, Ada.Float_Text_IO;
use  TEXT_IO, Ada.Integer_Text_IO, Ada.Float_Text_IO;

procedure Ada0101 is
begin
    Put(3 + 5);              New_Line;
    Put(3 + 5,   Width=> 0); New_Line;
    Put(3 * 5,   Width=> 0); New_Line;
    Put(3 ** 5,  Width=> 0); New_Line;
    Put(5 / 3,   Width=> 0); New_Line;
    Put(5 mod 3, Width=> 0); New_Line;
    Put(5 rem 3, Width=> 0); New_Line;
    
    Put(Float(5) / Float(3)                          ); New_Line;
    Put(Float(5) / Float(3),                   Exp=>0); New_Line;
    Put(Float(5) / Float(3),          Aft=>10, Exp=>0); New_Line;
    Put(Float(5) / Float(3), Fore=>5, Aft=>10, Exp=>0); New_Line;
end Ada0101;
Compiling the source code....
$gnatmake ada0101.adb 2>&1
gcc -c ada0101.adb
gnatbind -x ada0101.ali
gnatlink ada0101.ali

Executing the program....
$ada0101 
          8
8
15
243
1
2
2
 1.66667E+00
 1.66667
 1.6666666269
    1.6666666269