Tuesday, November 2, 2021

Basic Arithmetic in C#

 

Machine Problem

Write a C# sharp program that will ask two integers,and display it's sum , difference , product ,quotient and remainders .

  I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.







Program Listing


Program.cs


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;


/* Prof. Jake Rodriguez Pomperada, MAED-IT, MIT

 * www.jakerpomperada.com and www.jakerpomperada.blogspot.com

 * jakerpomperada@gmail.com 

 

 * Machine Problem

  Write a C# sharp program that will ask two integers 

  and display it's sum , difference , product ,quotient and remainders . */


 

namespace Basic_Arithmetic

{

    class Program

    {

        static void Main(string[] args)

        {

            Console.Write("\n\n");

            Console.Write("\tBasic Arithmetic in C# ");

            Console.Write("\n\n");

            Console.Write("\tGive First Value : ");

            int val_1 = Convert.ToInt32(Console.ReadLine());


            Console.Write("\tGive Second Value : ");

            int val_2 = Convert.ToInt32(Console.ReadLine());


            Console.Write("\n");

            Console.Write("\tDisplay Results ");

            Console.Write("\n\n");

            Console.WriteLine("\t{0} + {1} = {2}", val_1, val_2, val_1 + val_2);

            Console.WriteLine("\t{0} - {1} = {2}", val_1, val_2, val_1 - val_2);

            Console.WriteLine("\t{0} x {1} = {2}", val_1, val_2, val_1 * val_2);

            Console.WriteLine("\t{0} / {1} = {2}", val_1, val_2, val_1 / val_2);

            Console.WriteLine("\t{0} mod {1} = {2}", val_1, val_2, val_1 % val_2);

            Console.ReadKey();

        }

    }

}




No comments:

Post a Comment