Create programs that require the input of a string. Example: If input = hello
Output:
hello
e l
l l
l e
olleh
Code:
//print "hello" first line
for a<-1 to Length(sentence),a++
{
print sentence[a]
print newline
}
//print the second line of until before the last line
for a<-2 to Length(sentence)
{
print sentence[a]
for b<-1 to Length(sentence)-2{print space}
print sentence[Length(sentence)+1-a]
print newline
}
//print "olleh" last line
for a<-Length(sentence) downto 1,a-
{
print sentence [a]
}
No comments:
Post a Comment