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

Hàm Opp

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Hàm Opp

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

using System;

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

namespace ConsoleApp1
{
class Program
{
static double a, b;
static int chon;
static int menu()
{
Console.WriteLine("--------MENU--------");
Console.WriteLine("1.nhap 2 so nguyen");
Console.WriteLine("2.Tinh hieu hai so");
Console.WriteLine("3.thoat");
Console.WriteLine("MOI BAN CHON");
Console.Write("nhap lua chon");
chon = int.Parse(Console.ReadLine());
return chon;
}

static void nhap(ref double a,ref double b)


{
Console.WriteLine("nhap vao a="); a = double.Parse(Console.ReadLine());
Console.WriteLine("nhap vao b="); b = double.Parse(Console.ReadLine());

static double hieu(double a , double b)


{
return a - b;
}

static void Main(string[] args)


{
int chon;
bool quit = false;
while (true)
{

chon = menu();
if (chon == 1)
{
nhap(ref a, ref b);

else if (chon == 2)
Console.WriteLine($"Hieu cua {a} va {b} la: {hieu(a, b)}");

else if (chon == 3)
{
Console.WriteLine("Ban chon thoat ? Bam phim bat ky de thoat");
Console.ReadKey();
quit = true;
break;
}
if (quit == true)
break;
Console.ReadKey();

}
}
}
}

You might also like