I am a beginner C programmer so my question may sound vague but please bear it with me ;). So I was trying to create a program in which the user enters the subject he has passed in (There are three options : Math, Physics or both) and based on the input the computer prints the prize money on the screen. But when I execute the program it just exits after the first IF STATEMENT, for example if I enter the option BOTH or PHYSICS, The output still shows $5 prize which should be only shown when math is given as the input. Can you guys kindly guide me what mistake I am making? Thanks in advance, Bilal Ahmed.
#include<stdio.h>
int main(int argc, char const *argv[])
{
char Math,Physics,Both,subject;
printf("Please enter the name of the subjects you have passed in...\nOptionA)Math\nOptionB)Physics\nOptionC)Both\n");
scanf("%s", & subject);
if (subject= Math)
{
printf("you will receive $5\n");
}
else if (subject= Physics)
{
printf("you will receive $10\n");
}
else if (subject= Both)
{
printf("you will receive $15\n");
}
return 0
}