From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: * X-Spam-Status: No, score=1.5 required=3.0 tests=BAYES_50,FREEMAIL_FROM, FROM_STARTS_WITH_NUMS autolearn=no autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:a0c:eb49:: with SMTP id c9mr8989024qvq.37.1612025707228; Sat, 30 Jan 2021 08:55:07 -0800 (PST) X-Received: by 2002:a25:5f02:: with SMTP id t2mr13804420ybb.161.1612025706986; Sat, 30 Jan 2021 08:55:06 -0800 (PST) Path: eternal-september.org!reader02.eternal-september.org!goblin1!goblin.stu.neva.ru!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 30 Jan 2021 08:55:06 -0800 (PST) In-Reply-To: <60158b04$0$19449$426a34cc@news.free.fr> Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=85.242.255.219; posting-account=rhqvKAoAAABpikMmPHJSZh4400BboHwT NNTP-Posting-Host: 85.242.255.219 References: <60158b04$0$19449$426a34cc@news.free.fr> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Pascal triangle algorithm ("homework"). iterative one. the direct one was simple. From: Mehdi Saada <00120260a@gmail.com> Injection-Date: Sat, 30 Jan 2021 16:55:07 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:61247 List-Id: > To get an answer, you have to describe your problem.=20 > Posting code and console output is not enough. Sorry. well it should output the n_rank'th (here 6th, but in general as giv= en in the argument) row of Pascal's triangle, through iterating over each r= ow until the required one. there are two loops. first one, the main one, change rows after filling them at each iteration, = then swap temp1( n-1 row) and temp2 (nth row). then the second ,inner loop, where apparently the problem is. Here it loops= over a single row, by filling each element of the nth row one at a time by= adding the nth and (n-1)th element of the preceding row. It does compute i= t for the first second first loop iteration as shown by the verification (t= emp2(i) =3D temp1(i-1) + temp1(i) =3D 2) but from there, since the swap routine works, I don't understand why it doe= s not carry one. temp2 : 1 2 why from there can't it continue, with temp2(3) :=3D temp1(2) + temp1(3) [ = =3D 1 + 0 ... well now I don't remember whether or not I put a 0 at the end of each r= ow. But If I didn't it should crash ? Unless N should be incremented an the loop continues one further... I'll test that... once GNAT works again, as it crashes twice... two differe= nt versions, as explained elsewhere. Not my fault, for once. I hope I explained better.