A little help pls | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

A little help pls

I forgot how to let the program Calculate the percentage of smth

3rd Apr 2024, 1:04 PM
Lennart Lang
Lennart Lang - avatar
9 Answers
+ 4
Think of percent as "per cent". That means per 100. The word "per" implies using a division operation. Another way to say it is "divide by 100". So, 25 percent is (25/100). When you see the word "of" in mathematics, it usually means multiply. So 25 percent of 80 means: (25/100) * 80 = (0.25) * 80 = 20 If you are working with integers then (25/100) would become 0. It is best to perform the multiplication first, and then the division without parentheses. This will produce correct results for integers: 80 * 25 / 100
3rd Apr 2024, 1:42 PM
Brian
Brian - avatar
+ 1
In the Paint Costs task, calculate the cost and tax separately. Then add them together. The final step is to round up. Don't simply round it. You should use the ceil() function to round up.
3rd Apr 2024, 2:02 PM
Brian
Brian - avatar
+ 1
At this point I will need to see your code. Maybe I can spot something that you overlooked. Would you mind posting it here, or better yet, a link to the code in the playground?
3rd Apr 2024, 2:06 PM
Brian
Brian - avatar
0
Ah
3rd Apr 2024, 1:43 PM
Lennart Lang
Lennart Lang - avatar
0
I tried it and it doesn't work good
3rd Apr 2024, 1:45 PM
Lennart Lang
Lennart Lang - avatar
0
I'm trying to do the c# challenge named paint costs, and there is still smth wrong
3rd Apr 2024, 1:46 PM
Lennart Lang
Lennart Lang - avatar
0
I already did
3rd Apr 2024, 2:03 PM
Lennart Lang
Lennart Lang - avatar
0
But it doesn't work, 2 of the 5 objectives are still undone
3rd Apr 2024, 2:04 PM
Lennart Lang
Lennart Lang - avatar
0
Ok
3rd Apr 2024, 2:07 PM
Lennart Lang
Lennart Lang - avatar