Demo entry 6709127

Sample solution to problem p15613 from jutge.org

   

Submitted by anonymous on Feb 01, 2018 at 23:40
Language: Ada. Code size: 857 Bytes.

with Ada.Integer_Text_IO;
with Ada.Text_IO;

-- Learning to program (Introduction)
-- Temperatures

procedure p15613 is
   subtype Temperatura is Integer range -273 .. Integer'Last;

   t: Temperatura;

   Punt_Congelacio: constant Temperatura := 0;
   Punt_Fredor:     constant Temperatura := 10;
   Punt_Calor:      constant Temperatura := 30;
   Punt_Ebullicio:  constant Temperatura := 100;
begin
   Ada.Integer_Text_IO.Get(t);

   if t < Punt_Fredor then
      Ada.Text_IO.Put_Line("fa fred");
   elsif t > Punt_Calor then
      Ada.Text_IO.Put_Line("fa calor");
   else
      Ada.Text_IO.Put_Line("s'esta be");
   end if;

   if t <= Punt_Congelacio then
      Ada.Text_IO.Put_Line("l'aigua es gelaria");
   end if;

   if t >= Punt_Ebullicio then
      Ada.Text_IO.Put_Line("l'aigua bulliria");
   end if;
end p15613;

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).