im new to c language and i am facing some problems with my code.. I have to make a program that computes the prices for renting cars but the while loop is not functioning properly.The scanf above the while condition is %s and not %c because it wont let me give a characther when it is %c.Thank you in advance.
int main(){
float skms, ekms, tkms, price;
char catcode;
int days;
do{
printf("Selected rental program:\n");
scanf("%c",&catcode);
printf("Enter number of days:\n");
scanf("%d",&days);
printf("Starting kilometers display:\n");
scanf("%f",&skms);
printf("Kilometers display at end of rent:\n");
scanf("%f",&ekms);
tkms=(ekms/10)-(skms/10);
switch(catcode){
case'a':
case'A':
price=ammountDueA(days, tkms);
printf("%.2f\n",price);
break;
case'b':
case'B':
price=ammountDueB(days, tkms);
printf("%.2f\n",price);
break;
case'c':
case'C':
price=ammountDueC(days, tkms);
printf("%.2f\n",price);
}
printf("Select rental program.('Q' or 'q' to exit)\n");
scanf("%s",&catcode);
}while(catcode==!'Q'&&catcode==!'q');
printf("%c",catcode);
return 0;
}