Answer the question
In order to leave comments, you need to log in
How to express a formula in C?
There is a formula for determining speed: V=S/t
In C I get values and one of them is not known.
printf("V="); scanf("%d", &v);
printf("S="); scanf("%d", &s);
printf("t="); scanf("%d", &t);
And if any of them is missing, I have to find it by expressing the formula.
I don't want to hardcode it using if for every formula. Is it possible to do it without them?
Answer the question
In order to leave comments, you need to log in
As many as three ifs. What a hardcode! Not like libraries of symbolic calculations.
Using the three lines of code you wrote, you will not be able to NOT enter some value. First you need to deal with this. And in any case, you will have to use either if or switch.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question