Activity 2
3. Output or Prints the following pattern. Ask the user for the value of Seed ( number of rows). You can print in the next line by printing '\n' or putting the '\n' inside the double quotes. You may also print a special variable endl.
CPE102L
1Q1819Info! Broken links? Email us at gtechphofficial@gmail.com
Seed = 4 ***** ***** ***** *****
Seed = 3 ABCDE FGHIJ KLMNO Note: If the logic run out of letter you just go back to character 'A'
Seed = 5 * ** *** **** *****
Seed = 6 * * * * * * * * * * * * * * * * * * * * *
Seed = 5 BCDFG HJKLM NPQRS TVWXY ZBCDF Note: If the logic run out of letter you just go back to character 'A'
start
int rows
int i=1
print “Enter number of rows: ”
input rows
while (i<=rows)
print ”*****\n”
i++
endwhile
end
start
int rows
int i=1, init=1
char out=’A’
print “Enter number of rows: ”
input rows
while (i<=rows)
while (init<=5)
print out
init++
out++
if (out>Z)
out=’A’
endif
endwhile
print endl
init=1
i++
endwhile
end
start
int rows
int i=1, i2=1, i3
print “Enter number of rows: ”
input rows
int temprows=rows
i3=temprows
while (i<=rows)
while (i2<temprows)
print “ “
i2++
endwhile
i2=1
while (i3<=rows && i3>0)
print “*”
i3++
endwhile
i3=temprows-1
temprows--
print endl
i++
endwhile
end
start
int rows
int i=1, i2=1
print “Enter number of rows: ”
input rows
int temprows=rows
int i3=temprows
while (i<=rows)
while (i2<temprows)
print “ “
i2++
endwhile
i2=1
while (i3<=rows && i3>0)
print “* ”
i3++
endwhile
i3=temprows-1
temprows--
print endl
i++
endwhile
end
start
int rows
int i=1, init=1
char out=’A’
print “Enter number of rows: ”
input rows
while (i<=rows)
while (init<=5)
if (out==’A’ || out==’E’ || out==’I’ || out==’O’ || out==’U’)
out++
endif
print out
init++
out++
if (out>Z)
out=’A’
endif
endwhile
print endl
init=1
i++
endwhile
end