How to solve programming problems using conditional constructs in C#. There are some programming exercises are given below. Do the exercises and improve your programming skills in conditional constructs.
Qu1:Write a program of tax calculation. Accept money as input from the user and calculate the tax using following pattern.
Money | Percentage | Total Tax |
---|---|---|
Less than 10,000 | 5% | ? |
10,000 to 100,000 | 8% | ? |
More than 100,000 | 8.5% | ? |
Qu2:Write a program for library management system in which display the user option and based on option shows them available book.
Option:
c: for computer books
m: for mathematical books
h: for history books
e: for English books
If user input wrong value then shows them message try again and serve the input prompt again using goto label statement.
Summary
In this chapter, you learned how to solve programming problems using conditional constructs in C#. In next session, you will know about various C# Statements.