Course Title: Introduction to Programming (CS201)

 

·        Lecture No. 5

 

Conditional Statements

Flow Charting

Sample Program 1

 

 

 

Logical Operators

Sample Program 2

Tips

 

 

 

Conditional Statements

 

In every day life, we are often making decisions. We perform different tasks while taking decisions. For example, the statement ‘Bring one litre of milk while returning home from college, if the milk shop is open’ involves this phenomenon.

In this statement, there is an element of decision making. We bring one litre of milk if the shop is open. And if the shop is closed, we come back to home without milk.

Thus we are making a decision on the condition that the shop is open. The decision-making process is everywhere in our daily life. We see that the college gives admission to a student if he has the required percentage in his previous examination and/or in the entry test. Similarly administration of a basketball team of the college decides that the students having height more than six feet can be members of the team.

In the previous lectures, we have written simple elementary programs. For writing interesting and useful programs, we have to develop the decision making power in them.

Now we will see what kind of decisions are in programming and how these can be used.

 

 

 

 

 

NEXT