This code should print the word starting with input character but something wrong with it.
I have already checked by using fflush(stdin)
#include<stdio.h>
int main(){
char str;
int n,in;
scanf("%d",&n);
for(in=0;in<n;in++){
scanf("%c",&str);
for(in=0;in<n;in++){
if((str=='b')||(str=='B'))
printf("Battleship");
else if((str=='c')||(str=='C'))
printf("Cruiser");
else if((str=='d')||(str=='D'))
printf("Destroyer");
else
printf("Fringate");
}
}
}
When I am providing test case, it is not taking input and getting out of the program.