MyMath Four principles

Source: Internet
Author: User

Tag:c#   class    software    string   

<pre name= "code" class= "CSharp" >////Copyright (c) level 2014 software 1 classes/all rithts reseved.//A36 Huanghade//Completion Date: December 10, 2014//// Problem Description: Create a program for two integers to add, subtract, multiply, divide//Input Description: Enter two numbers from the keyboard number1, number2//output Description: Outputs the results of Add,substract,multiply,divide respectively//using System;using system.collections.generic;using system.linq;using system.text;using System.Threading.Tasks;namespace Consoleapplication3{class Program {static void Main (string[] args) {int number1            , number2;            Console.WriteLine ("Please enter the first integer:"); number1 = Int.            Parse (Console.ReadLine ());            Console.WriteLine ("Please enter the first integer:"); number2 = Int.           Parse (Console.ReadLine ());            Console.WriteLine ("Sum of two integers: {0}", Mymath.add (Number1,number2));           Console.WriteLine ("Difference of two integers: {0}", Mymath.substract (Number1, number2));           Console.WriteLine ("Two integers multiplied: {0}", Mymath.multiply (Number1, number2));           Console.WriteLine ("Divide two integers: {0}", Mymath.divide (Number1, number2)); Console.readkey(); }} class MyMath {static public int Add (int one, int)//define Add method to process addition {R            Eturn one + one;            } static public int substract (int one, int)//define Substract method to process subtraction {return one-two; } static public int Multiply (int one, int)//define Multiply method to process multiplication {return one            * BOTH;            } static public int Divide (int one, int)//define Divide method to process division {return one/two; }        }}

MyMath Four principles

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.