Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Program.cs
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Calculation;
- namespace EXP1
- {
- class Program
- {
- static void Main(string[] args)
- {
- MathLibrary obj = new MathLibrary();
- Console.WriteLine("Enter First Number");
- int a = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Enter Second Number");
- int b = Convert.ToInt32(Console.ReadLine());
- float substract = obj.Sub(a, b);
- float multiply = obj.Mul(a, b);
- float addition = obj.Add(a, b);
- float divide = obj.Div(a, b);
- float power = obj.Power(a);
- Console.WriteLine("This Application uses functions from MathLibrary.dll todo simple calculations");
- Console.WriteLine("Addition:" + addition);
- Console.WriteLine("Substraction:" + substract);
- Console.WriteLine("Multilication:" + multiply);
- Console.WriteLine("Dividation:" + divide);
- Console.WriteLine("Power of a given Number:" + power);
- Console.ReadLine();
- }
- }
- }
- //calculation.cs
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Calculation
- {
- public class MathLibrary
- {
- public int Add(int a, int b)
- {
- return a + b;
- }
- public int Sub(int a, int b)
- {
- return a - b;
- }
- public int Div(int a,int b)
- {
- return a / b;
- }
- public int Mul(int a,int b)
- {
- return a * b;
- }
- public float Power(float a)
- {
- return a * a;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement