Google

Wednesday, January 13, 2010

CSC202 & ENG4033M : If - Else Statements & Relational-Equality Operators





Text Version:

/* if statements */
#include "stdio.h"
int main()
{
int a=10, b=3, c=3;
if(b==3){
printf("equals\n");
}
if(a>b){
printf("bigger than\n");
}
if(c=c){
printf("bigger than or equal to\n");
}
if(b<=c){ printf("smaller than or equal to\n"); } return 0; } Another way to write it:


Note also the operator !=
which means NOT EQUAL TO

IF-ELSE example: