Computing Fundamentals: Dr. Muhammad Yousaf Hamza
Computing Fundamentals: Dr. Muhammad Yousaf Hamza
if (age<=12)
printf("Please go to Child Specialist in Room 10\n\n");
else
printf("Please go to Medical Specialist in Room 15\n");
printf(Allah Hafiz");
getchar();
return 0;
}
Dr. Yousaf, PIEAS
The if Statement
Form 1:
if (expression)
statement1;
next statement;
Form 2:
if (expression)
statement1;
else
statement2;
next statement;
false true
age < = 12
print 15 print 10
Equals == x == y NOT x = y
Greater than > x > y
Less than < x< y
Greater/equals >= x >= y
Less than/equals <= x <= y
Not equal != x != y
&& AND
|| OR
! NOT
.
.
.
true case z break
case z
false action(s)
default
action(s)
Dr. Yousaf, PIEAS