Docsity

C# Console Application: Geometry Calculations, Exercises of Information Systems

Toggle sidebar
bg1
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
internal class Program
{
static void Main(string[] args)
{
Cau_1();
Cau_2();
Cau_3();
Cau_4();
Cau_5();
}
static void Cau_1()
{
Console.Write("Ban kinh hinh tron la: ");
float r = float.Parse(Console.ReadLine());
float CV = (float)(2*r*Math.PI);
float S = (float)(Math.PI * r * r);
Console.WriteLine("Chu vi hinh tron la {0}\nDien tich hinh tron la {1}",CV,S);
}
static void Cau_2()
{
Console.Write("So ngay di lam: ");
int ngay = int.Parse(Console.ReadLine());
Console.Write("So con cai: ");
int con=int.Parse(Console.ReadLine());
int TLNC = 100000 * ngay;
int PC = 150000 * con;
int BHXH = TLNC * 15/100 ;
int TL = TLNC + PC - BHXH;
Console.WriteLine("Tien luong ngay cong la {0} VND\nTien phu cap la {1} VND", TLNC,
PC);
Console.WriteLine("Dong Bao hiem xa hoi la {0} VND\nTien lanh {1} VND", BHXH, TL);
}
static void Cau_3()
{
Console.Write(" Diem thi mon toan : ");
float Toan = float.Parse(Console.ReadLine());
Console.Write(" Diem thi mon ly : ");
float Ly = float.Parse(Console.ReadLine());
Console.Write(" Diem thi mon hoa : ");
float Hoa = float.Parse(Console.ReadLine());
float TC = (float)(Toan + Ly + Hoa);
float TB = (float)(TC / 3);
pf2

Partial preview of the text

Download C# Console Application: Geometry Calculations and more Exercises Information Systems in PDF only on Docsity!

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp { internal class Program { static void Main(string[] args) { Cau_1(); Cau_2(); Cau_3(); Cau_4(); Cau_5(); } static void Cau_1() { Console.Write("Ban kinh hinh tron la: "); float r = float.Parse(Console.ReadLine()); float CV = (float)(2rMath.PI); float S = (float)(Math.PI * r * r); Console.WriteLine("Chu vi hinh tron la {0}\nDien tich hinh tron la {1}",CV,S); } static void Cau_2() { Console.Write("So ngay di lam: "); int ngay = int.Parse(Console.ReadLine()); Console.Write("So con cai: "); int con=int.Parse(Console.ReadLine()); int TLNC = 100000 * ngay; int PC = 150000 * con; int BHXH = TLNC * 15/100 ; int TL = TLNC + PC - BHXH; Console.WriteLine("Tien luong ngay cong la {0} VND\nTien phu cap la {1} VND", TLNC, PC); Console.WriteLine("Dong Bao hiem xa hoi la {0} VND\nTien lanh {1} VND", BHXH, TL); } static void Cau_3() { Console.Write(" Diem thi mon toan : "); float Toan = float.Parse(Console.ReadLine()); Console.Write(" Diem thi mon ly : "); float Ly = float.Parse(Console.ReadLine()); Console.Write(" Diem thi mon hoa : "); float Hoa = float.Parse(Console.ReadLine()); float TC = (float)(Toan + Ly + Hoa); float TB = (float)(TC / 3);

Console.WriteLine("Diem tong cong la {0}\nDiem trung binh la {1}", TC,TB); } static void Cau_4() { Console.WriteLine(" Canh hinh vuong 1 la: "); float a = float.Parse(Console.ReadLine()); Console.WriteLine(" Canh hinh vuong 2 la: "); float b = float.Parse(Console.ReadLine()); float c = (float)(Math.Sqrt(a * a + b * b)); float CV = (float)(a + b + c); float S = (float)(a*b/2); Console.WriteLine("Hinh vuong co canh huyen la: {0}\nChu vi la: {1}\nDien tich la: {2} ",c,CV,S ); } static void Cau_5() { Console.WriteLine("Canh cua hinh vuong la "); float a = float.Parse(Console.ReadLine()); float CVHV = a * 4; Console.WriteLine("Chu vi hinh vuong la :" + CVHV); float R = (float)(CVHV / (2 * Math.PI)); Console.WriteLine("Ban kinh la :" + R); } } }