mardi 7 décembre 2021

Scanf function not taking input pls helpp [duplicate]

This is my code and in this the age, marital status and gender input are not working please help me fix this I am noob and new to stack overflow ;(

#include <stdio.h>
    
    int main(){
        int age;
        char ms;
        char gender;
        printf("\nEnter age: ");
        scanf("%d",&age);
        printf("\nEnter marital status: ");
        scanf("%c",&ms);
        printf("\nEnter gender: ");
        scanf("%c",&gender);
    
        if(ms=='M'||ms=='U'&&gender=='M'&& age>=30||ms=='U'&&gender=='F'&& age>=25)
        printf("Driver is insured.");
        return 0;
    }

Aucun commentaire:

Enregistrer un commentaire