jeudi 28 octobre 2021

I'm a beginner at c and tried creating an if else programme but it's not working

#include <stdio.h>

int main();

{char subject[];
printf("Name of the subject you've passed.\n");
scanf("%s", &subject );
if (subject == "maths" ){ 
printf("You receive 100 Rs. \n");
}else if(subject == "science"){
printf("You receive 50 Rs. \n");
}
return 0;}

I think the code is fine but i am unable to find the problem.

Aucun commentaire:

Enregistrer un commentaire