Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
24
Task/Floyds-triangle/XPL0/floyds-triangle.xpl0
Normal file
24
Task/Floyds-triangle/XPL0/floyds-triangle.xpl0
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
include c:\cxpl\codes; \include 'code' declarations
|
||||
|
||||
func IntLen(N); \Return number of digits in a positive integer
|
||||
int N;
|
||||
int I;
|
||||
for I:= 1 to 20 do
|
||||
[N:= N/10; if N=0 then return I];
|
||||
|
||||
proc Floyd(N); \Display Floyd's triangle
|
||||
int N;
|
||||
int M, Row, Col;
|
||||
real F;
|
||||
[M:= (N-1+1)*(N-1)/2; \last Floyd number on second to last row
|
||||
F:= 1.0; \Floyd number counter
|
||||
for Row:= 1 to N do
|
||||
[for Col:= 1 to Row do
|
||||
[Format(IntLen(M+Col)+1, 0); RlOut(0, F); F:= F+1.0];
|
||||
CrLf(0);
|
||||
];
|
||||
]; \Floyd
|
||||
|
||||
[Floyd(5);
|
||||
Floyd(14);
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue