الاثنين، 15 أكتوبر 2018

خلدون عصفور 
برنامج يقوم المستخدم به بادخال رقمين ويختار العمليه التي يريدها والبرنامج يقوم بطباعه الجواب


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication8
{
    class Program
    {
        static void Main(string[] args)
        {
            int a,b,c ;
           
            Console.WriteLine ("plz enter num1");
           a=int.Parse(Console.ReadLine());
           Console.WriteLine("plz enter num2");
           b = int.Parse(Console.ReadLine());
            Console.WriteLine("press 1 for addition +");
            Console.WriteLine("press 2 for multipication *");
            Console.WriteLine("press 3 for subtract -");

            c = int.Parse(Console.ReadLine());
            switch (c)
            {
                case 1:
                    Console.WriteLine("the result is" + (a + b));
                    break;
                case 2:
                    Console.WriteLine("the result is" + (a * b));
                    break;
                case 3:
                    Console.WriteLine("the result is" + (a - b));
                    break;
            }
                    Console.ReadKey();
    }
    }
}

ليست هناك تعليقات:

إرسال تعليق