0% found this document useful (0 votes)
8 views2 pages

COC2071 - Lab Manuals 01 (C# Fundamentals) - 2

This lab manual for Object Oriented Programming (COC2071) focuses on C# fundamentals, covering topics such as variables, operators, decisions, and iterations. It includes practical exercises like creating console applications, performing arithmetic operations, using conditional statements, and implementing loops. The manual provides step-by-step tasks to enhance programming skills through hands-on experience.

Uploaded by

ahassan7695
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

COC2071 - Lab Manuals 01 (C# Fundamentals) - 2

This lab manual for Object Oriented Programming (COC2071) focuses on C# fundamentals, covering topics such as variables, operators, decisions, and iterations. It includes practical exercises like creating console applications, performing arithmetic operations, using conditional statements, and implementing loops. The manual provides step-by-step tasks to enhance programming skills through hands-on experience.

Uploaded by

ahassan7695
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Object Oriented Programming – COC2071

Lab Manuals 01 (C# Fundamentals)

The objective of this lab is to get hands on working on the following topics:
▪ Variables, and Operators
▪ Decisions
▪ Iterations

Variables, and Operators


1. − Create a console application in C#.
− Declare variables (string name, int age, double height).
− Assign values and display them.

2. − Declare two integers (num1, num2).


− Perform addition, subtraction, multiplication, and division.
− Display the results.

3. − Prompt the user for their name and age.


− Read input.
− Display a greeting message.

4. − Take two numbers as input.


− Compute LCM using the formula: LCM(a, b) = (a * b) / GCD(a, b)

Decisions
5. − Ask for user age.
− If age >= 18, display "Welcome to cricket club."
− Else, display "You are too young to play for club."

6. − Take two numbers as input.


− Ask the user to choose +, -, *, /.
− Use switch to perform the operation.

7. − Input three numbers.


− Use if-else to find and print the largest.

8. − Take an integer input.


− Reverse the number and compare it with the original.

Iterations
9. − Print numbers from 1 to 10 using while.

10. − Take a number as input.


− Print its multiplication table up to 10.

11. − Input a password from the user.


− Ask to re-enter password until "1234" is entered.

Page 1 of 2
Object Oriented Programming – COC2071
Lab Manuals 01 (C# Fundamentals)

The objective of this lab is to get hands on working on the following topics:
▪ Variables, and Operators
▪ Decisions
▪ Iterations

12. − Take an integer input.


− Compute factorial using a loop.

13. − Take n as input.


− Compute sum = 1 + 2 + ... + n.

14. − Input a number.


− Reverse and print it.

15. − Input an integer.


− Use while loop to count digits.

16. − Take an integer input.


− Extract digits using % and sum them.
− Example:
− Input: 456
− Output: 4 + 5 + 6 = 15

17. − Display a menu with options like:


▪ Check Even/Odd
▪ Find Factorial
▪ Print Raise to Power
▪ Exit
− Take user input, perform the selected task using switch-case.

Page 2 of 2

You might also like