0
In C language 'scanf' function does not work.
I am an extreme beginner and write this code. But in output scanf function do not ask a value to enter. Please correct me. #include <stdio.h> int main() { int maths, science; printf ("passing marks for each subject is 33 out of 100\n"); printf ("enter your marks in maths: \n "); scanf ("%d", &maths); printf ("enter your marks in science:\n"); scanf("%d", &science); if(maths>33) {printf ("you will got a gift of 15/- rs. \n"); } if(science>33) {printf ("you will got a gift of 15/- rs. \n"); } if((maths & science) > 33) {printf ("you will got a gift of 45/- rs. \n"); } return 0; }
3 Réponses
+ 2
Ankit Agarwal in Sololearn, codeplayground asks input to enter one's only and you need to put all inputs by space separating or in newline according to methods you used for input.
So on hitting run, a pop-up will occur. Give all inputs and enter. Then you can see output..
For your code, give
Ex: 50 50
Edit :
in tags, pls remove link and add language.
Add link in description..
You have wrong logic in 3rd if condition too.
Run this code and see how to handle SoloLearn input..
https://code.sololearn.com/WhiNb9BkJUVC/?ref=app
+ 4
Let's begin by moving that code link out of the tags and into the Description. Code link in tags cannot be accesed, need to put it in Description 👍
+ 1
You have a problem with the third conditional branch, the line should be something like this
if(maths > 33 && science > 33)
// branch body here ...