comp.lang.ada
 help / color / mirror / Atom feed
From: "Doker" <doker0@wp.pl>
Subject: Big numbers
Date: Mon, 18 Apr 2005 12:49:27 +0200
Date: 2005-04-18T12:49:27+02:00	[thread overview]
Message-ID: <d402ru$2meo$1@node2.news.atman.pl> (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;





             reply	other threads:[~2005-04-18 10:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-18 10:49 Doker [this message]
2005-04-18 13:40 ` Big numbers John B. Matthews
2005-04-18 18:53   ` Doker
2005-04-18 21:22     ` Jacob Sparre Andersen
2005-04-19 18:19       ` Doker
replies disabled

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