# How to use if statement

What wrong with my 'if' statement? (All are integer)
How to specify two condition in one if statement (e.g How to say if A > B and B < C then ...)?

if (StartHour >= 8 AND (StartTime < 18 * 60 + 59))
{
if (EndHour < 19)
{
FullRateMinute = EndTime - StartTime;
goto CalculateAmount;
}
else
FullRateMinute = (18 * 60 + 59) - StartTime;
}

Thank you.
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
Hi
see the correction
U cannot use AND should use && in C
use brackets to seperate conditions
if ((StartHour >= 8) && (StartTime < (18 * 60 + 59))
{
if (EndHour < 19)
{
FullRateMinute = EndTime - StartTime;
goto CalculateAmount;
}
else
FullRateMinute = (18 * 60 + 59) - StartTime;
}

0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Commented:
To say A > B and B < C
U should say
if ((A > B) && (B < C ))
{
......
}
0
Commented:
You don't need the parenthesis. Only assignment operators have a lower precedence then && and ||
0
Author Commented:
Thank you very much!
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.