comp.lang.ada
 help / color / mirror / Atom feed
* Big numbers
@ 2005-04-18 10:49 Doker
  2005-04-18 13:40 ` John B. Matthews
  0 siblings, 1 reply; 5+ messages in thread
From: Doker @ 2005-04-18 10:49 UTC (permalink / raw)


program like that one can count only up to 29. what can i do to deal with 
data up to 100?

with Ada.Text_Io;

use Ada.Text_Io;

procedure Silnia is

A : Long_Long_Integer;

package Lng_Int_Io is new Ada.Text_Io.Integer_Io(Long_Long_Integer);

use Lng_Int_Io;

function Silnia (

Liczba : Long_Long_Integer)

return Long_Long_Integer is

Efekt : Long_Long_Integer := 1;

begin

for I in 2..Liczba loop

Efekt := Efekt * I;

end loop;

return Efekt;

end;

begin

Put_Line("start");

loop

begin

New_Line;

Put("give a number:");

Get(A);

if A >28 then

Put_Line ("can't do with this");

raise Constraint_Error;

end if;

Put ("the result is ");

Put(Long_Long_Integer'Image(Silnia(A)));

exit;

exception

when Data_Error =>

Put("Data Error ");

Skip_Line;

when Constraint_Error =>

Put("Constraint Error ");

Skip_Line;

end;

end loop;

end Main;





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-04-19 18:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-18 10:49 Big numbers Doker
2005-04-18 13:40 ` John B. Matthews
2005-04-18 18:53   ` Doker
2005-04-18 21:22     ` Jacob Sparre Andersen
2005-04-19 18:19       ` Doker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox