⚠️ Notice: This page contains archived content and may reference older versions of C# or .NET. For the latest tutorials, updated examples, and best practices for C# 12 and .NET 8, please visit the latest tutorials ⚠️
 

C# Razor Practice Questions

In this chapter you will get some practice questions to solve. You must solve them using your programming logic. It will help you to understand razor syntax more efficiently.
Qu 1: Write a program to convert following datatypes:
  1. String "32" into int
  2. Float "12.52" into float
  3. Decimal "123.345" into decimal.
You must check type of value before converting.
Qu 2: Write a program to find all the even number between 12 and 42 using looping and conditional statements.
Qu 3: Write a program to display array on the screen. Array value should be like this. 2,6,2,55,62,64,67
Qu 4: Write a function for calculator with exception handling that returns division of two numbers.