Greatest element of a list: Difference between revisions
Content deleted Content added
add gwbasic |
|||
Line 1,832: | Line 1,832: | ||
In '''[https://formulae.org/?example=Greatest_element_of_a_list this]''' page you can see the program(s) related to this task and their results. |
In '''[https://formulae.org/?example=Greatest_element_of_a_list this]''' page you can see the program(s) related to this task and their results. |
||
=={{header|GW-BASIC}}== |
|||
<lang gwbasic>10 INPUT "How many items? ", N% |
|||
20 DIM ARR(N%) |
|||
30 FOR I% = 0 TO N%-1 |
|||
40 PRINT "Value of item #";I% |
|||
50 INPUT ARR(I%) |
|||
60 NEXT I% |
|||
70 CHAMP = ARR(0) : INDEX = 0 |
|||
80 FOR I% = 1 TO N%-1 |
|||
90 IF ARR(I%)>CHAMP THEN CHAMP=ARR(I%):INDEX=I% |
|||
100 NEXT I% |
|||
110 PRINT "The maximum value was ";CHAMP;" at index ";INDEX;"." |
|||
120 END</lang> |
|||
=={{header|GAP}}== |
=={{header|GAP}}== |