September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
|
|
@ -30,6 +30,8 @@ Specifically print out the following pattern by using one for loop nested in ano
|
|||
* [[Loops/N plus one half]]
|
||||
* [[Loops/Nested]]
|
||||
* [[Loops/While]]
|
||||
* [[Loops/with multiple ranges]]
|
||||
* [[Loops/Wrong ranges]]
|
||||
<br><br>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,19 @@
|
|||
For i = 1 TO 5
|
||||
For j = 1 To i
|
||||
TextWindow.Write("*")
|
||||
EndFor
|
||||
TextWindow.WriteLine("")
|
||||
EndFor
|
||||
OPENCONSOLE
|
||||
|
||||
FOR X=1 TO 5
|
||||
|
||||
FOR Y=1 TO X
|
||||
|
||||
LOCATE X,Y:PRINT"*"
|
||||
|
||||
NEXT Y
|
||||
|
||||
NEXT X
|
||||
|
||||
PRINT
|
||||
|
||||
CLOSECONSOLE
|
||||
|
||||
END
|
||||
|
||||
'Could also have been written the same way as the Creative Basic example, with no LOCATE command.
|
||||
|
|
|
|||
|
|
@ -1,11 +1,6 @@
|
|||
If OpenConsole()
|
||||
Define i, j
|
||||
For i=1 To 5
|
||||
For j=1 To i
|
||||
Print("*")
|
||||
Next j
|
||||
PrintN("")
|
||||
Next i
|
||||
Print(#LFCR$+"Press ENTER to quit"): Input()
|
||||
CloseConsole()
|
||||
EndIf
|
||||
for i = 1 to 5
|
||||
for j = 1 to i
|
||||
print "*";
|
||||
next
|
||||
print
|
||||
next
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
FOR i = 1 TO 5
|
||||
FOR j = 1 TO i
|
||||
PRINT "*";
|
||||
NEXT j
|
||||
PRINT
|
||||
NEXT i
|
||||
For i = 1 TO 5
|
||||
For j = 1 To i
|
||||
TextWindow.Write("*")
|
||||
EndFor
|
||||
TextWindow.WriteLine("")
|
||||
EndFor
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
for n = 1 to 5
|
||||
for m = 1 to n
|
||||
print "*";
|
||||
next m
|
||||
print
|
||||
next n
|
||||
If OpenConsole()
|
||||
Define i, j
|
||||
For i=1 To 5
|
||||
For j=1 To i
|
||||
Print("*")
|
||||
Next j
|
||||
PrintN("")
|
||||
Next i
|
||||
Print(#LFCR$+"Press ENTER to quit"): Input()
|
||||
CloseConsole()
|
||||
EndIf
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
Public OutConsole As Scripting.TextStream
|
||||
For i = 0 To 4
|
||||
For j = 0 To i
|
||||
OutConsole.Write "*"
|
||||
Next j
|
||||
OutConsole.WriteLine
|
||||
Next i
|
||||
FOR i = 1 TO 5
|
||||
FOR j = 1 TO i
|
||||
PRINT "*";
|
||||
NEXT j
|
||||
PRINT
|
||||
NEXT i
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
For x As Integer = 0 To 4
|
||||
For y As Integer = 0 To x
|
||||
Console.Write("*")
|
||||
Next
|
||||
Console.WriteLine()
|
||||
Next
|
||||
for n = 1 to 5
|
||||
for m = 1 to n
|
||||
print "*";
|
||||
next m
|
||||
print
|
||||
next n
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
10 FOR i = 1 TO 5
|
||||
20 FOR j = 1 TO i
|
||||
30 PRINT "*";
|
||||
40 NEXT j
|
||||
50 PRINT
|
||||
60 NEXT i
|
||||
Public OutConsole As Scripting.TextStream
|
||||
For i = 0 To 4
|
||||
For j = 0 To i
|
||||
OutConsole.Write "*"
|
||||
Next j
|
||||
OutConsole.WriteLine
|
||||
Next i
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
10 FOR I = 1 TO 5
|
||||
20 FOR J = 1 TO I
|
||||
30 PRINT "*";
|
||||
40 NEXT
|
||||
50 PRINT
|
||||
60 NEXT
|
||||
For x As Integer = 0 To 4
|
||||
For y As Integer = 0 To x
|
||||
Console.Write("*")
|
||||
Next
|
||||
Console.WriteLine()
|
||||
Next
|
||||
|
|
|
|||
6
Task/Loops-For/BASIC/loops-for-18.basic
Normal file
6
Task/Loops-For/BASIC/loops-for-18.basic
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
10 FOR i = 1 TO 5
|
||||
20 FOR j = 1 TO i
|
||||
30 PRINT "*";
|
||||
40 NEXT j
|
||||
50 PRINT
|
||||
60 NEXT i
|
||||
|
|
@ -1,21 +1,6 @@
|
|||
OPENCONSOLE
|
||||
|
||||
FOR X=1 TO 5
|
||||
|
||||
FOR Y=1 TO X
|
||||
|
||||
PRINT"*",:'No line feed or carriage return after printing.
|
||||
|
||||
NEXT Y
|
||||
|
||||
PRINT
|
||||
|
||||
NEXT X
|
||||
|
||||
PRINT:PRINT"Press any key to end."
|
||||
|
||||
DO:UNTIL INKEY$<>""
|
||||
|
||||
CLOSECONSOLE
|
||||
|
||||
END
|
||||
10 FOR I = 1 TO 5
|
||||
20 FOR J = 1 TO I
|
||||
30 PRINT "*";
|
||||
40 NEXT
|
||||
50 PRINT
|
||||
60 NEXT
|
||||
|
|
|
|||
|
|
@ -1,6 +1,21 @@
|
|||
10 FOR I = 1 TO 5
|
||||
20 FOR J = 1 TO I
|
||||
30 PRINT "*";
|
||||
40 NEXT J
|
||||
50 PRINT
|
||||
60 NEXT I
|
||||
OPENCONSOLE
|
||||
|
||||
FOR X=1 TO 5
|
||||
|
||||
FOR Y=1 TO X
|
||||
|
||||
PRINT"*",:'No line feed or carriage return after printing.
|
||||
|
||||
NEXT Y
|
||||
|
||||
PRINT
|
||||
|
||||
NEXT X
|
||||
|
||||
PRINT:PRINT"Press any key to end."
|
||||
|
||||
DO:UNTIL INKEY$<>""
|
||||
|
||||
CLOSECONSOLE
|
||||
|
||||
END
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
#APPTYPE CONSOLE
|
||||
FOR dim i = 1 TO 5
|
||||
FOR dim j = 1 TO i
|
||||
PRINT "*";
|
||||
NEXT j
|
||||
PRINT
|
||||
NEXT i
|
||||
Pause
|
||||
10 FOR I = 1 TO 5
|
||||
20 FOR J = 1 TO I
|
||||
30 PRINT "*";
|
||||
40 NEXT J
|
||||
50 PRINT
|
||||
60 NEXT I
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
FOR n = 1 to 5 CYCLE
|
||||
FOR k = 1 to n CYCLE
|
||||
print "*";
|
||||
REPEAT
|
||||
#APPTYPE CONSOLE
|
||||
FOR dim i = 1 TO 5
|
||||
FOR dim j = 1 TO i
|
||||
PRINT "*";
|
||||
NEXT j
|
||||
PRINT
|
||||
REPEAT
|
||||
END
|
||||
NEXT i
|
||||
Pause
|
||||
|
|
|
|||
|
|
@ -1,19 +1,7 @@
|
|||
OPENCONSOLE
|
||||
|
||||
FOR X=1 TO 5
|
||||
|
||||
FOR Y=1 TO X
|
||||
|
||||
LOCATE X,Y:PRINT"*"
|
||||
|
||||
NEXT Y
|
||||
|
||||
NEXT X
|
||||
|
||||
PRINT
|
||||
|
||||
CLOSECONSOLE
|
||||
|
||||
FOR n = 1 to 5 CYCLE
|
||||
FOR k = 1 to n CYCLE
|
||||
print "*";
|
||||
REPEAT
|
||||
PRINT
|
||||
REPEAT
|
||||
END
|
||||
|
||||
'Could also have been written the same way as the Creative Basic example, with no LOCATE command.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
for i = 1 to 5
|
||||
for j = 1 to i
|
||||
print "*";
|
||||
next
|
||||
print
|
||||
next
|
||||
100 FOR I=1 TO 5
|
||||
110 FOR J=1 TO I
|
||||
120 PRINT "*";
|
||||
130 NEXT
|
||||
140 PRINT
|
||||
150 NEXT
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
import extensions.
|
||||
import extensions;
|
||||
|
||||
program =
|
||||
[
|
||||
0 till:5 do(:i)
|
||||
[
|
||||
0 to:i do(:j)
|
||||
[ console write:"*" ].
|
||||
public program()
|
||||
{
|
||||
for(int i := 0, i < 5, i += 1)
|
||||
{
|
||||
for(int j := 0, j <= i, j += 1)
|
||||
{ console.write:"*" };
|
||||
|
||||
console writeLine
|
||||
].
|
||||
].
|
||||
console.writeLine()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
7
Task/Loops-For/GW-BASIC/loops-for.gw-basic
Normal file
7
Task/Loops-For/GW-BASIC/loops-for.gw-basic
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
100 FOR I=1 TO 5
|
||||
110 FOR J=1 TO I
|
||||
120 PRINT "*";
|
||||
130 NEXT J
|
||||
140 PRINT
|
||||
150 NEXT I
|
||||
160 END
|
||||
4
Task/Loops-For/Prolog/loops-for.pro
Normal file
4
Task/Loops-For/Prolog/loops-for.pro
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
example :-
|
||||
between(1,5,I), nl, between(1,I,_J),
|
||||
write('*'), fail.
|
||||
example.
|
||||
|
|
@ -3,8 +3,7 @@
|
|||
do j=1 for 5 /*this is the same as: do j=1 to 5 */
|
||||
$= /*initialize the value to a null string*/
|
||||
do k=1 for j /*only loop for a J number of times*/
|
||||
$=$ || '*' /*using concatenation (||) for build.*/
|
||||
$= $ || '*' /*using concatenation (||) for build.*/
|
||||
end /*k*/
|
||||
say $ /*display character string being built.*/
|
||||
end /*j*/
|
||||
/*stick a fork in it, we're all done. */
|
||||
end /*j*/ /*stick a fork in it, we're all done. */
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@
|
|||
do j=1 for 5 /*this is the same as: do j=1 to 5 */
|
||||
$= /*initialize the value to a null string*/
|
||||
do k=1 for j /*only loop for a J number of times*/
|
||||
$=$'*' /*using abutment for the construction. */
|
||||
$= $'*' /*using abutment for the construction. */
|
||||
end /*k*/
|
||||
say $ /*display character string being built.*/
|
||||
end /*j*/
|
||||
/*stick a fork in it, we're all done. */
|
||||
end /*j*/ /*stick a fork in it, we're all done. */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
fn main() {
|
||||
for i in 0..5 {
|
||||
for _ in 0..(i + 1) {
|
||||
for _ in 0..=i {
|
||||
print!("*");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
for (i <- 1 to 5) {
|
||||
for (j <- 1 to i)
|
||||
print("*")
|
||||
println
|
||||
println()
|
||||
}
|
||||
|
|
|
|||
18
Task/Loops-For/Spin/loops-for.spin
Normal file
18
Task/Loops-For/Spin/loops-for.spin
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
con
|
||||
_clkmode = xtal1 + pll16x
|
||||
_clkfreq = 80_000_000
|
||||
|
||||
obj
|
||||
ser : "FullDuplexSerial.spin"
|
||||
|
||||
pub main | m, n
|
||||
ser.start(31, 30, 0, 115200)
|
||||
|
||||
repeat n from 1 to 5
|
||||
repeat m from 1 to n
|
||||
ser.tx("*")
|
||||
ser.str(string(13,10))
|
||||
|
||||
waitcnt(_clkfreq + cnt)
|
||||
ser.stop
|
||||
cogstop(0)
|
||||
6
Task/Loops-For/Swift/loops-for.swift
Normal file
6
Task/Loops-For/Swift/loops-for.swift
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
for i in 1...5 {
|
||||
for _ in 1...i {
|
||||
print("*", terminator: "")
|
||||
}
|
||||
print()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue