You are on page 1of 2

BAI8

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

namespace bai8
{
internal class Program
{
static void Main(string[] args)
{
int n;
n = int.Parse(Console.ReadLine());
if (n % 2 == 0)
Console.WriteLine("so {0} la so chan", n);
else
Console.WriteLine( "so {0} la so le");

Console.ReadKey();

}
}

BAI6

Console.WriteLine("nhap 4 so a,b,c,d= ");


double a = double.Parse(Console.ReadLine());
double b = double.Parse(Console.ReadLine());
double c = double.Parse(Console.ReadLine());
double d = double.Parse(Console.ReadLine());
double max, min, med; max = a;
if (max < b) max = b;
if (max < c) max = c;
if (max < d) max = d; min = a;
if (min > b) min = b;
if (min > c) min = c;
if (min > d) min = d;
Console.WriteLine("so lon nhat la: {0}", max);
Console.Write("so be nhat la : {0}", min);
Console.ReadKey();

BAI3
string ptinh;
double kq1, kq = 0;
Console.Write("nhap chinh xac phep tinh can tinh +,-,*,:/,can ");
ptinh = Console.ReadLine();
if (ptinh == "can")
Console.Write("nhap phep toan hang = ");
double c = double.Parse(Console.ReadLine());
kq1 = Math.Sqrt(c);
Console.WriteLine("ket qua cua phep tinh can bac 2 cua {0} = {1} ", c, Math.Round(kq1, 4));

if (ptinh != "can")

Console.Write("nhap phep toan tu = ");


double a = double.Parse(Console.ReadLine());
Console.Write("nhap phep toan hang = ");
double b = double.Parse(Console.ReadLine());
if (ptinh == "+") kq = a + b;
if (ptinh == "-") kq = a - b;
if (ptinh == "*") kq = a * b;
if (ptinh == "/") kq = a / b;
Console.WriteLine("ket qua cua phep tinh {0} {1} {2} = {3} ", a, ptinh, b,
Math.Round(kq, 4));

Console.ReadKey();

You might also like