When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
152 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
@lost niche
Your message appears to contain screenshots but no code. Please send code and error messages in text instead of screenshots if applicable!
Show your code
Hey so you should ignore the value that scanf() reutrns
you are making an if statement with the scanf() inside the if statement
No.
what you should do instead is put the scanf out of it and evaluate the variable that you just read
scanf does not return the number it read
Yes?
it returns the number of characters?
removed the "if" before the scanf and it made it worse
You should not remove the if
It still returns information if it read something or not. That is important to check^^
you should take the scanf out of the if inside of it
Why?
yes but not for this case
It is.
cuz he wants to evaluate the score of the student
everything else is correct but it keeps saying this
not the reutnr value of the scanf function
what was the input on that
What if no score was entered
it will read '\n'
it still reads something
No.
what was the input on tose casaes
cases
try removing the 2 printf("Invalid score\n"); lines?
what number did u put to the computer
yea
ok ok
scanf doesnt return the number you input it returns how many inputs it took(in this case 1)
omg thank u
Why did you add it in the first place? 
It's not in the exercise
So what? Why not check if scanf failed to read the number?
Yes? That was, what i was getting at?
I thought I needed to make it clearer
Dude 
oh my bad i misunderstood then
it is bro
it said that if the value is not between 0 or 100 it should input an error message
It says to print "Error: score should be in range ..."
am i reading wrong?
It doesn't say to print "invalid input"
ohhh ok
The grader is automatic, if you print extra stuff "to make it clearer" of course it's gonna fail you
i honestly dont even know where to start with the second one
you should learn logic gates
do I just fine the avg
pardon?
it would make you if() alot easier and cleaner
lemme try brb
Good luck
oh so he is checking if theres inputs there with the first if?
What? 😛
Yeah
Yeah, you haven't tried much here. Start by calculating the average score
is declaring grade variables required by the question?
oh ok
That is a fast way for generating bugs and unsafe code^^
No hate, just an advice
Yeah ofc bro im not taking as hate
we're here to help each other
thank you
but like i dont plan on using C as a profession i think
im in 11th grade hs
Idea: recycle the code you used for the first task^^
Maybe encapsulate it in an own function, that just returns the read value, if valid 🙂
Sorry for off topic but how do i delete a repositorie on github
But you can programm robots with it (sorta 😂)
Hhaahha ik for real
yeah I give up wtf
noo
dont give up bro once you get the hang of it it will be easy
2 am and i feel sick
What's a own function
Recursion?
do I just calculate the avg using the double avg 😵💫
Yea I mean why not
i honestly dont know how
so printf("avg score: %d", (score1+score2+score3+score4/4));?
Shoulnt there be parenthesis
you should use a float or a double as the type of the avg to avoid truncation
these instructions omfg
Just replace%d with %0.2d
it made it worse
How many decimal points is it showing
mb didnt notice it
No
Like it says everything is mismatched
Idk anymore
Could you send a ss of your code
Omfg my laptop froze
Lemme take a pic
Wait my laptop crashed
Omfg bruh, it’s nearly 3am now
are you allowed to use arrays and loops in this program
I think so
npnp i couldnt help much either way lol
Go sleep!
ya get some sleep
@lost niche
Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. In the future you can use !solved to close a post and mark a post as solved.
How do I close btw
hey btw i have a question
Thank you and let us know if you have any more questions!
This thread is now set to auto-hide after an hour of inactivity
What is it? 😛
why is the data getting rounded off
int divided by an int always results in another int, truncating the fractional part
It doesn't matter that the result is assigned to a float, the truncation happens before that
You need to make at least one of the operands a float, e.g. / 4.f
Ohhh
Thanks ! it worked
No.
int inc(int input);
int main(void) {
int i = 3;
i = inc(i);
return 0;
}
int inc(int input) {
int output = input + 1;
return output;
}
inc is a function
main is also a function.
scanf aswell