when I enter 48 on marks of science and 34 on marks of maths. I want output like ''you have passed on Science and failed on maths...... ..... only.". But the output is "You have passed both the subjects.... ... ... ... ...Rs. 45." The code is of C language and written in Visual studio code.
#include <stdio.h>
int main()
{
int Mark_On_Science;
int Mark_On_Maths;
printf("Enter your marks on Science:\n");
scanf("%d", &Mark_On_Science);
printf("Enter your marks on Maths:\n");
scanf("%d", &Mark_On_Maths);
printf("you have entered %d as mark of Science and %d as mark of Maths.\n \n So ", Mark_On_Science, Mark_On_Maths);
if (Mark_On_Maths >= 40, Mark_On_Science >= 40)
{
printf("you have passed both the subjects so you will get Rs. 45.");
}
else if (Mark_On_Maths < 40, Mark_On_Science >= 40)
{
printf("you have passed on Science and failed on Maths so you will get Rs 15 only.");
}
else if (Mark_On_Science < 40, Mark_On_Maths >= 40)
{
printf("you have passed on Maths and failed on Science so you will get Rs 15 only.");
}
else
{
printf("You failed on both subjects. Study hard and You will be passed next time.");
}
return 0;
}
Aucun commentaire:
Enregistrer un commentaire