program management (condition ifelse,else,if,switchcase)
PROGRAM MANAGEMENT:-
There are two method
i. condition
ii. flow/looping
CONDITION-
1. ifelse
2.elseif
3.switch case
1. if else:-
if(condition)
{
}
else
{
}
q]. write a program to input age from the user and check the following condition
con- age>18 then display you can vote
otherwise display you cannot vote.
property of ifelse
ifelse only use 1 condition at a time.
2. else if statement:
if(con)
{statement};
elseif(cond)
{statement};
else
{statement};
Q] write a program to input % from the user and check the following condition
con- % >60 then display first division
con-%>50 and %<60 then display second division
if %>40 and %<50 then display third division otherwise fail
#SWITCHCASE - IT is basically used to connect a specify case(part of programm) as per user choice
switch(choice variable)
{
case1: ------
------
break;
case2;-----
-----
break;
default:-----
-----
break;
}
Comments
Post a Comment