1. Trang chủ
  2. » Tất cả

Bài 1

4 4 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 4
Dung lượng 42,2 KB

Nội dung

Bài 1: Nhập vào số nguyên hoán đổi giá trị số using using using using using System; System.Collections.Generic; System.Linq; System.Text; System.Threading.Tasks; namespace ConsoleApplication7 { class Program { static void Main(string[] args) { int a, b, c, d; Console.Write("nhap vao so a: "); a = Convert.ToInt32(Console.ReadLine()); Console.Write("nhap vao so b: "); b = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("hoan doi gia tri cua hai so"); c = a; d = b; Console.WriteLine("so a = " + d); Console.WriteLine("so b = " + c); Console.ReadKey(); } } } Bài 2: Nhập vào số nguyên kiểm tra xem số số âm hay số dương using using using using using System; System.Collections.Generic; System.Linq; System.Text; System.Threading.Tasks; namespace ConsoleApplication8 { class Program { static void Main(string[] args) { Console.Write("nhap vao so nguyen: "); int a = Convert.ToInt32(Console.ReadLine()); if (a > 0) { Console.WriteLine("so vua nhap la so duong"); } else { Console.WriteLine("so vua nhap la so am"); } Console.ReadKey(); } } } Bài 3: Nhập vào số NĂM, kiểm tra xem năm có phải năm nhuận hay khơng Bài 5:Viết chương trình nhập vào cạnh tam giác, kiểm tra xem tam tác gì? (cân, đều, thường) using using using using using System; System.Collections.Generic; System.Linq; System.Text; System.Threading.Tasks; namespace ConsoleApplication9 { class Program { static void Main(string[] args) { Console.OutputEncoding = Encoding.UTF8; int a, b, c; Console.WriteLine("Kiểm tra tam giác"); Console.Write("nhập vào cạnh thứ 1: "); a = Convert.ToInt16(Console.ReadLine()); Console.Write("nhập vào cạnh thứ 2: "); b = Convert.ToInt16(Console.ReadLine()); Console.Write("nhập vào cạnh thứ 3: "); c = Convert.ToInt16(Console.ReadLine()); if ((a == b) && (a == c)) Console.WriteLine("tam giác đều"); else if ((a == b) || (a == c) || (b == c)) Console.WriteLine("tam giác cân"); else Console.WriteLine("tam giác thường"); Console.ReadKey(); } } } ... thứ 1: "); a = Convert.ToInt16(Console.ReadLine()); Console.Write("nhập vào cạnh thứ 2: "); b = Convert.ToInt16(Console.ReadLine()); Console.Write("nhập vào cạnh thứ 3: "); c = Convert.ToInt16(Console.ReadLine());... Console.WriteLine("so vua nhap la so am"); } Console.ReadKey(); } } } Bài 3: Nhập vào số NĂM, kiểm tra xem năm có phải năm nhuận hay khơng Bài 5:Viết chương trình nhập vào cạnh tam giác, kiểm tra xem

Ngày đăng: 14/04/2021, 14:41

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN

w