Introduction to if -else :
Suppose you go to market with 1000 rs and you have to buy chips ,cold drink , pen ,books.
So let us suppose that you think like a robot.
1. find price of chips.
2. find price of cold drink
3. find price of pen.
4. find price of books.
5. total the price and you remember the total.
6. check the total with amount which you have:
Now time to take a decision .
7. If total is less than 1000(your amount)'
you buy everything and get the change.
8. If total is more than 1000 :
then :
return the books.
now again check the total
if total is less than 1000:
purchase and get change.
if not then dont purchase anything
so this continues....let us write a c program using this.
No comments:
Post a Comment