Lesson 3.6

C# Operators – Programming Exercises


Objective

Programming Question of C# Operators

Qu. 1: Write a program for arithmetic operator in which ask 2 values from user and stores in different variable and then show output as adding, subtracting, multiplying and dividing.

Qu. 2: Write a Program for relational operator in which ask 2 values from user and stores in different variable. Compare them and show the output to user.

Qu. 3: Write a program in which ask user for following details:

Age
Sex

Now,

1. Check whether user is Male and 18 or 18+. If returns true then show welcome message

2. Check whether user is Male and below 18. If returns true show message teenager now allowed.

3. Check whether user is Female and any age show message "No Access".

Qu. 4: Write a Program for bitwise operator and performs operation on this value.

Num1= 38 //Binary Value = 0010 0110
Num2= 87 //Binary Value = 0101 0111

Summary

In this lesson you have learned all about operators in C# with programming examples and exercises. Next lesson is Conditional Constructs in which you will learn about if else, switch case and more C# keywords.

BackNext