Write an algorithm that displays an equivalent color once an input letter matches its first character.
Write a program that displays an equivalent color once an input letter match its first character.
For example, b for Blue, r for Red, and so on. Here are the given criteria:
Letters Colors
‘B’ or ‘b’ Blue
‘R’ or ‘r’ Red
‘G’ or ‘g’ Green
‘Y’ or ‘y’ Yellow
other letters “Unknown Color”
Algorithm:
Enter a letter(let)
if ((let==’B’) || (let==’b’))
print “Blue”
if ((let==’R’) || (let==’r’))
print “Red”
if ((let==’G’) || (let==’g’))
print “Green”
if ((let==’Y’) || (let==’y’))
print “Yellow”
Else
print ”Unknown Color”
Comments
Leave a comment