What am i missing? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What am i missing?

Help me with my code please, I'm writing a program that gets the total, then gives the owner 70% and the worker 30% but it's not working. This is the code below 👇 https://code.sololearn.com/cGz9N8m8wPb1/?ref=app

31st Jan 2023, 2:24 PM
Kingdavid Christian
Kingdavid Christian - avatar
2 Answers
+ 6
…like so //Code by Kingdavid Christian #include <stdio.h> #include <math.h> int main(){ float total, owner, worker; scanf("%f", &total); printf("The total is : %f\n", total); owner = 0.7 * total; worker = 0.3 * total; printf("The Owner gets: %f\nThe Worker gets : %f", owner, worker); return 0; }
31st Jan 2023, 2:36 PM
DavX
DavX - avatar
+ 3
David, you need to move your input for total up… As you are multiplying the percentage by the total, before you have taken input for the total.
31st Jan 2023, 2:33 PM
DavX
DavX - avatar