Trouble with else if statements in C combined with a calculation -
Ok guys, I'm a hell of a time with this. At present, if I am working on other statements in my C Class (Introduction to Programming, clearly) and I can not get the syntax for further statements. I have browsed the web and I have not received any relevant answer. I currently get the error: | 47 | Error: Expected ')' before the numeric constant.
#include & lt; Stdio.h & gt; # Include & lt; Stdlib.h & gt; # Include & lt; Math.h> Float p (float r, float v) {returns (v * v) / (r); } Int main () {float r, v, answer; // User puts a print for the title of the input and values ("Enter Voltage:"); Scanf ("% f", & amp; r); ("Enter resistance:"); Scanf ("% f", & amp; v); Answer = P (V, R); Printf ("PD =% 9F \ n", answer); Return 0; Scanf ("% f", answer); If (condition> = 0.25) / / If the condition is correct then print the following * / printf ("Warning: Power immersion should not exceed 1/4 watchers \ n"); } And if ((Answer) 0.25> <= & lt; 0.5>) {printf ("Warning: Power immersion should not exceed 1/2 watts \ n"); } Scanf ("% f", and reply); If ((Answer 0.5 & lt; & amp;;; = & lt; 1) printf ("Warning: Power recovery should not exceed 1 watt");}
There are a lot of syntax for your help.
code> (( Answer: 0.25 <= code> 0.5 & gt;)
is not valid. This is probably coming from your error message. But later, you also have
((0.5 & lt; & amp;;; = & lt; 1)
This is also not valid, and the Amp;;
is not and
operator,
This will probably help if you were trying to complete it with these statements. But, in general, you should probably if
before worrying about your basic details Review the C again.
Once you do this, then in a if
statement The common form of C is:
if (int) {statements;}
where int
is incorrect to It is supposed to be, if it is
0
, and true
if it is anything else (there is a lack of a native boolean type in C) You can either evaluate any expression inside an ()
or be convertible to each other for one. Assertions between {}
are evaluated only when the expression was true
.
Comments
Post a Comment