This question has already been solved: Start a new discussion instead

1.11M Members

3

Contributors3

Replies18

Views34 Minutes

Discussion SpanLast Updated by HelpWanted2115

Question

Answered

Answered

0

Hi guys, so yeah, I got some IT homework AGAIN on programs and I repeatedly did trace tables and they all worked, but somehow, when I enter it in turbo pascal, after the 10th number, the digits start to get negative and after the 6th number, its not following the sequence... Anyways, the question states: Write a program to generate the first 20 terms of the following sequence: 1,3,3,9,27,243,6561.........here's the program that I did:

```
program sequence;
uses wincrt;
var X,Y,Result,i:integer;
Begin
X:=1;
Y:=3;
Result:=X*Y;
Writeln(X);
Writeln(Y);
For i:=1 to 18 do
Begin
Y:=X;
X:=Result;
Result:=X*Y;
Writeln(Result);
End;
End.
```

You

This question has already been solved: Start a new discussion instead

Tags Related to this Article