Algorithm
problem Link ; https://www.codechef.com/problems/FLOW010
Problem
Write a program that takes in a letterclass ID of a ship and display the equivalent string class description of the given ID. Use the table below.
Input Format
The first line contains an integer T, the total number of testcases. Then T lines follow, each line contains a character.
Output Format
For each test case, display the Ship Class depending on ID, in a new line.
Constraints
- 1 ≤ T ≤ 1000
Sample 1:
Input
Output
3 B c D
BattleShip Cruiser Destroyer
Code Examples
#1 Code Example with C Programming
Code -
C Programming
#include<stdio.h>
int main()
{
int n,i;
char ch;
scanf("%d",&n);
for(i=1;i < =n;i++)
{
scanf(" %c",&ch);
if(ch=='B' || ch=='b') printf("BattleShip\n");
else if(ch=='C' || ch== 'c') printf("Cruiser\n");
else if(ch=='D' || ch== 'd') printf("Destroyer\n");
else if(ch=='F' || ch== 'f') printf("Frigate\n");
}
}
Copy The Code &
Try With Live Editor
Input
3
B
c
D
B
D
Output
BattleShip
Cruiser
Destroyer
Cruiser
Destroyer
Demonstration
CodeCherf solution FLOW010 - ID and Ship Codecherf solution in C,C++