tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
8
Task/Reverse-a-string/REXX/reverse-a-string-1.rexx
Normal file
8
Task/Reverse-a-string/REXX/reverse-a-string-1.rexx
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
/*REXX program to reverse a string (and show before and after strings).*/
|
||||
|
||||
string1 = 'A man, a plan, a canal, Panama!'
|
||||
string2 = reverse(string1)
|
||||
|
||||
say ' original string: ' string1
|
||||
say ' reversed string: ' string2
|
||||
/*stick a fork in it, we're done.*/
|
||||
10
Task/Reverse-a-string/REXX/reverse-a-string-2.rexx
Normal file
10
Task/Reverse-a-string/REXX/reverse-a-string-2.rexx
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
/*REXX program to reverse a string (and show before and after strings).*/
|
||||
|
||||
string1 = 'A man, a plan, a canal, Panama!'
|
||||
string2 =
|
||||
do j=1 for length(string1)
|
||||
string2 = substr(string1,j,1)string2
|
||||
end /*j*/
|
||||
say ' original string: ' string1
|
||||
say ' reversed string: ' string2
|
||||
/*stick a fork in it, we're done.*/
|
||||
3
Task/Reverse-a-string/REXX/reverse-a-string-3.rexx
Normal file
3
Task/Reverse-a-string/REXX/reverse-a-string-3.rexx
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
string2 = substr(string1,j,1) || string2
|
||||
/*───── or ─────*/
|
||||
string2=substr(string1,j,1)||string2
|
||||
10
Task/Reverse-a-string/REXX/reverse-a-string-4.rexx
Normal file
10
Task/Reverse-a-string/REXX/reverse-a-string-4.rexx
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
/*REXX program to reverse a string (and show before and after strings).*/
|
||||
|
||||
string1 = 'A man, a plan, a canal, Panama!'
|
||||
string2 =
|
||||
do j=length(string1) to 1 by -1
|
||||
string2 = string2 || substr(string1,j,1)
|
||||
end /*j*/
|
||||
say ' original string: ' string1
|
||||
say ' reversed string: ' string2
|
||||
/*stick a fork in it, we're done.*/
|
||||
Loading…
Add table
Add a link
Reference in a new issue