Practice 50 C# Math Programming Questions, TechnoVlogs

Practice 50 C# Math Programming Questions


Q1. Write a C# program to find the sum of two numbers.  
  Input: Number1 = 10, Number2 = 20  
  Output: Sum = 30

Q2. Write a C# program to calculate the difference between two numbers.  
  Input: Number1 = 15, Number2 = 5  
  Output: Difference = 10

Q3. Write a C# program to multiply two numbers.  
  Input: Number1 = 5, Number2 = 4  
  Output: Product = 20

Q4. Write a C# program to divide two numbers.  
  Input: Number1 = 10, Number2 = 2  
  Output: Quotient = 5

Q5. Write a C# program to find the remainder of two numbers.  
  Input: Number1 = 17, Number2 = 5  
  Output: Remainder = 2

Q6. Write a C# program to calculate the square of a number.  
  Input: Number = 5  
  Output: Square = 25

Q7. Write a C# program to calculate the cube of a number.  
  Input: Number = 3  
  Output: Cube = 27

Q8. Write a C# program to calculate the square root of a number.  
  Input: Number = 25  
  Output: Square Root = 5

Q9. Write a C# program to find the absolute value of a number.  
  Input: Number = -10  
  Output: Absolute Value = 10

Q10. Write a C# program to find the power of a number raised to another number.  
   Input: Base = 2, Exponent = 3  
   Output: Power = 8

Q11. Write a C# program to find the maximum of two numbers.  
   Input: Number1 = 10, Number2 = 20  
   Output: Maximum = 20

Q12. Write a C# program to find the minimum of two numbers.  
   Input: Number1 = 10, Number2 = 20  
   Output: Minimum = 10

Q13. Write a C# program to calculate the area of a circle.  
   Input: Radius = 7  
   Output: Area = 153.94

Q14. Write a C# program to calculate the area of a rectangle.  
   Input: Length = 5, Width = 10  
   Output: Area = 50

Q15. Write a C# program to calculate the perimeter of a rectangle.  
   Input: Length = 5, Width = 10  
   Output: Perimeter = 30

Q16. Write a C# program to calculate the area of a triangle.  
   Input: Base = 6, Height = 8  
   Output: Area = 24

Q17. Write a C# program to calculate the circumference of a circle.  
   Input: Radius = 7  
   Output: Circumference = 43.96

Q18. Write a C# program to check if a number is even.  
   Input: Number = 8  
   Output: Even

Q19. Write a C# program to check if a number is odd.  
   Input: Number = 5  
   Output: Odd

Q20. Write a C# program to check whether a number is divisible by another number.  
   Input: Number1 = 10, Number2 = 2  
   Output: Divisible

Q21. Write a C# program to convert Celsius to Fahrenheit.  
   Input: Celsius = 25  
   Output: Fahrenheit = 77

Q22. Write a C# program to convert Fahrenheit to Celsius.  
   Input: Fahrenheit = 77  
   Output: Celsius = 25

Q23. Write a C# program to calculate the average of three numbers.  
   Input: Number1 = 10, Number2 = 20, Number3 = 30  
   Output: Average = 20

Q24. Write a C# program to find the factorial of a number.  
   Input: Number = 5  
   Output: Factorial = 120

Q25. Write a C# program to find the sum of all numbers from 1 to n.  
   Input: n = 5  
   Output: Sum = 15

Q26. Write a C# program to find the sum of even numbers from 1 to n.  
   Input: n = 10  
   Output: Sum of even numbers = 30

Q27. Write a C# program to find the sum of odd numbers from 1 to n.  
   Input: n = 10  
   Output: Sum of odd numbers = 25

Q28. Write a C# program to calculate the perimeter of a square.  
   Input: Side = 5  
   Output: Perimeter = 20

Q29. Write a C# program to find the cube root of a number.  
   Input: Number = 27  
   Output: Cube Root = 3

Q30. Write a C# program to calculate the compound interest.  
   Input: Principal = 1000, Rate = 5, Time = 2  
   Output: Compound Interest = 102.5

Q31. Write a C# program to calculate the simple interest.  
   Input: Principal = 1000, Rate = 5, Time = 2  
   Output: Simple Interest = 100

Q32. Write a C# program to find the roots of a quadratic equation.  
   Input: a = 1, b = -3, c = 2  
   Output: Roots = 2, 1

Q33. Write a C# program to find the sum of squares of first n natural numbers.  
   Input: n = 5  
   Output: Sum of squares = 55

Q34. Write a C# program to find the sum of cubes of first n natural numbers.  
   Input: n = 3  
   Output: Sum of cubes = 36

Q35. Write a C# program to find the greatest common divisor (GCD) of two numbers.  
   Input: Number1 = 12, Number2 = 18  
   Output: GCD = 6

Q36. Write a C# program to find the least common multiple (LCM) of two numbers.  
   Input: Number1 = 12, Number2 = 18  
   Output: LCM = 36

Q37. Write a C# program to generate a random number between 1 and 100.  
   Input: None  
   Output: Random number = 42

Q38. Write a C# program to round a decimal number to the nearest integer.  
   Input: Number = 5.67  
   Output: Rounded Number = 6

Q39. Write a C# program to calculate the logarithm of a number.  
   Input: Number = 100  
   Output: Logarithm = 2

Q40. Write a C# program to calculate the sine of an angle (in radians).  
   Input: Angle = 1  
   Output: Sine = 0.84147

Q41. Write a C# program to calculate the cosine of an angle (in radians).  
   Input: Angle = 1  
   Output: Cosine = 0.54030

Q42. Write a C# program to calculate the tangent of an angle (in radians).  
   Input: Angle = 1  
   Output: Tangent = 1.55741

Q43. Write a C# program to calculate the exponential of a number.  
   Input: Number = 2  
   Output: Exponential = 7.38906

Q44. Write a C# program to find the nth Fibonacci number.  
   Input: n = 5  
   Output: Fibonacci = 5

Q45. Write a C# program to find the remainder when a number is divided by another number.  
   Input: Number1 = 15, Number2 = 4  
   Output: Remainder = 3

Q46. Write a C# program to calculate the hypotenuse of a right triangle.  
   Input: Side1 = 3, Side2 = 4  
   Output: Hypotenuse = 5

Q47. Write a C# program to check if a number is a perfect square.  
   Input: Number = 16  
   Output: Perfect square

Q48. Write a C# program to find the absolute difference between two numbers.  
   Input: Number1 = 10, Number2 = 15  
   Output: Difference = 5

Q49. Write a C# program to find the arithmetic mean of a list of numbers.  
   Input: Array = [2, 4, 6, 8]  
   Output: Mean = 5

Q50. Write a C# program to calculate the area of a trapezoid.  
   Input: Base1 = 5, Base2 = 10, Height = 6  
   Output: Area = 45

Share on Social Media