C Nested If Examples
bonus = 0;
if (sales > 300000)
{if (years_employed > 2)
{bonus = 1000;}
else
{bonus = 500;}
}
{printf(“bonus = %f”, bonus);}
**********************************
if (age > 17)
{ if (registered = = 1)
{printf(“you may vote”);}
else
{printf(“you must register to vote”);}
}
else
{ printf(“you are too young to vote”);}