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

ArithmeticOperations

This C# program performs basic arithmetic operations on three user-input numbers. It includes methods for addition, multiplication, subtraction, and division, with error handling for division by zero. The results of each operation are displayed in the console.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

ArithmeticOperations

This C# program performs basic arithmetic operations on three user-input numbers. It includes methods for addition, multiplication, subtraction, and division, with error handling for division by zero. The results of each operation are displayed in the console.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

using System;

namespace ArithmeticOperations

class Program

static void Main(string[] args)

Console.Write("Enter first number: ");

double num1 = Convert.ToDouble(Console.ReadLine());

Console.Write("Enter second number: ");

double num2 = Convert.ToDouble(Console.ReadLine());

Console.Write("Enter third number: ");

double num3 = Convert.ToDouble(Console.ReadLine());

Console.WriteLine("Sum: " + Add(num1, num2, num3));

Console.WriteLine("Product: " + Multiply(num1, num2, num3));

Console.WriteLine("Difference: " + Subtract(num1, num2, num3));

Console.WriteLine("Quotient: " + Divide(num1, num2, num3));

static double Add(double num1, double num2, double num3)

return num1 + num2 + num3;

static double Multiply(double num1, double num2, double num3)

{
return num1 * num2 * num3;

static double Subtract(double num1, double num2, double num3)

return num1 - num2 - num3;

static double Divide(double num1, double num2, double num3)

if (num2 == 0 || num3 == 0)

throw new DivideByZeroException();

return num1 / num2 / num3;

You might also like