Problem in C | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Problem in C

Hi, im a beginner and i have a problem im trying some codes for practice and i dont know where is the problem in this. Can someone help me please? https://code.sololearn.com/cFISvoRnK1ZM/#c

25th Mar 2018, 2:09 AM
Franco Fonzo
Franco Fonzo - avatar
8 Answers
+ 2
Could you link to a Code Playground copy of this, instead of pasting it here?
25th Mar 2018, 2:14 AM
Dread
Dread - avatar
+ 2
Could you also explain in depth what the issue is? 👍 It will help save time, and get the issue resolved quicker.
25th Mar 2018, 2:19 AM
Dread
Dread - avatar
+ 2
When you check if c is equal to "Y", you're using the assignment operator (=). You want to use the "equal to" operator (==). Write this: if (c == 'Y'){ // insert the rest of the code }
25th Mar 2018, 2:21 AM
DaemonThread
DaemonThread - avatar
+ 2
Oh, I didn't see that. 😂 Good job @DaemonThread!
25th Mar 2018, 2:21 AM
Dread
Dread - avatar
+ 1
In the if() statement, enter Y in single quotes ( 'Y' ), rather than double ( "Y" ).
25th Mar 2018, 2:33 AM
DaemonThread
DaemonThread - avatar
0
Thanks i forget put de double equal, but the problem its in when I enter the value "Y" it doesn't enter on if and just go to else why is this?
25th Mar 2018, 2:28 AM
Franco Fonzo
Franco Fonzo - avatar
0
Thanks i already fix that but when i put Y to change the value from "a" it doesnt do the if and go directly to the else
25th Mar 2018, 2:43 AM
Franco Fonzo
Franco Fonzo - avatar
0
Thanks for your help i have help from a firend, he said me to put fflush(stdin); before the scanf(%char,&a); that fix it
25th Mar 2018, 2:58 AM
Franco Fonzo
Franco Fonzo - avatar