From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7255bf4b86d6b125 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!g44g2000cwa.googlegroups.com!not-for-mail From: "isaac2004" Newsgroups: comp.lang.ada Subject: Re: help with starting a program (newbie) Date: 17 Feb 2006 10:05:13 -0800 Organization: http://groups.google.com Message-ID: <1140199513.110445.267520@g44g2000cwa.googlegroups.com> References: <1140126464.020101.55150@o13g2000cwo.googlegroups.com> <1140193368.725447.184020@g44g2000cwa.googlegroups.com> NNTP-Posting-Host: 140.160.138.134 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1140199518 10528 127.0.0.1 (17 Feb 2006 18:05:18 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 17 Feb 2006 18:05:18 +0000 (UTC) In-Reply-To: <1140193368.725447.184020@g44g2000cwa.googlegroups.com> User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: g44g2000cwa.googlegroups.com; posting-host=140.160.138.134; posting-account=bWy1LAwAAAAtVkasDCH0ykMCBMNd-FcL Xref: g2news1.google.com comp.lang.ada:2936 Date: 2006-02-17T10:05:13-08:00 List-Id: > If you make an attempt, and get stuck, and post a small piece of code here, we will help you understand why it doesn't work. well i have a little code here that defines the Sum_Of_Devisors and Sociable Chain procedures here is the code i have so far with Ada.Text_Io; use Ada.Text_Io; with Ada.Integer_Text_Io; use Ada.Integer_Text_Io; procedure Sociablechain is --------------------------------------------------------------------- --| program that takes a range in the form of a minimum and maximum number, --| and prompts for the length, to find all sociable chains inside of the range --| to that desired chain --| Isaac Levin, Western Washington --| February 2006 --------------------------------------------------------------------------- Minnumber : Natural range 0 .. Integer'Last; Maxnumber : Natural range Minnumber .. Integer'Last; Length : Natural range 1 .. 30; -- start of function that takes the inputted number and finds the sum of the divisors -- function description function Sum_Of_Divisors ( N : Natural ) return Natural; -- function body function Sum_Of_Divisors ( N : Natural ) return Natural is Sum : Natural; begin Sum := 0; for I in 1 .. N - 1 loop if N rem I = 0 then Sum := Sum + I; end if; end loop; return Sum; end Sum_Of_Divisors; procedure Sociable_Chain ( Minnumber, Maxnumber : Natural ) is A : array (1 .. 30) of Positive; I : Positive; begin A(1) :=Minnumber; A(2) := Sum_Of_Divisors (A(1)); while I < Length and A (1) /= A(I) loop I:= I + 1; A(I) := Sum_Of_Divisors (A(I - 1)); end loop; end Sociable_Chain; begin for N in Minnumber..Maxnumber loop Sociable_Chain(Minnumber, Length); end loop; Put(Item => " Please enter your starting integer. "); Get(Item => Minnumber); New_Line; Put(Item => " Please enter your ending integer. "); Get(Item => Maxnumber); New_Line; Put(Item => " Please choose the length of your chain. "); Get(Item => Length); end; its sloppy but thats how i am thinking right now