ID and SHIP

Description:

Write a program that takes in a letter class ID of a ship and display the equivalent string class description of the given ID. Use the table below. Class ID Ship Class B or b BattleShip C or c Cruiser D or d Destroyer F or f Frigate Test Case 1 Input (stdin) 1 B Expected Output BattleShip Test Case 2 Input (stdin) 2 F f Expected Output Frigate Frigate

Program :

#include <stdio.h>

int main()

{  int n,i;

    char ch;

    scanf("%d",&n);

    for(i=0;i<2*n;i+=1)

    {  scanf("%c",&ch);

        switch(ch)

        {  case 'b': printf("BattleShip\n");

                    break;

            case 'B': printf("BattleShip\n");

                    break;

            case 'c': printf("Cruiser\n");

                    break;

            case 'C': printf("Cruiser\n");

                    break;

            case 'd': printf("Destroyer\n");

                    break;

            case 'D': printf("Destroyer\n");

                    break;

            case 'f': printf("Frigate\n");

                    break;

            case 'F': printf("Frigate\n");

                    break;

        }  

    }  

    return 0;


}