1.1
Console.WriteLine("Ten cua ban la gi?");
string ten = Console.ReadLine();
Console.WriteLine("Ban sinh nam bao nhieu?");
string t = Console.ReadLine();
int namsinh = Int16.Parse(t);
int tuoiht = 2009 - namsinh;
int tuoitl = 2010 - namsinh;
Console.Clear();
Console.Write("Ten ban la {0}\nHien nay ban {1} tuoi\nDen nam 2010 ban {2} tuoi", ten, tuoiht, tuoitl);
Console.ReadLine();
//by Zero
-----------------------------------------------
1.2
Console.WriteLine("Tinh gia tri bieu thuc Y=2*3+4*x-7");
Console.WriteLine("Nhap gia tri x=?");
string x = Console.ReadLine();
int bien = Int16.Parse(x);
int y = 4 * bien - 1;
Console.Write("Gia tri cua Y= " + y);
Console.Read();
//by Zero
-----------------------------------------------
1.3
Console.WriteLine("Chuong trinh tinh gia tri bieu thuc\tP(x,y)=4x*x-2xy+6x*y*y-13");
Console.WriteLine("Nhap cac gia tri x,y");
string x1 = Console.ReadLine();
string x2 = Console.ReadLine();
int x = Int16.Parse(x1);
int y = Int16.Parse(x2);
int p=4*x*x-2*x*y+6*x*y*y-13;
Console.WriteLine("Bieu thuc co gia tri P = " + p);
Console.Read();
//by Zero
-----------------------------------------------
1.4
Console.WriteLine("Nhap ho ten:");
string ten = Console.ReadLine();
Console.WriteLine("Chi so dien ke thang truoc");
string sotrct = Console.ReadLine();
Console.WriteLine("Chi so dien ke thang sau");
string sosau = Console.ReadLine();
int t = Int16.Parse(sotrct);
int s = Int16.Parse(sosau);
Console.WriteLine("********************************");
Console.WriteLine(" Hoa don tien dien");
Console.WriteLine("Khac hang: "+ten);
Console.WriteLine("Chi so cu: "+ t);
Console.WriteLine("Chi so moi:"+s);
Console.WriteLine("Tieu thu: "+(s-t));
Console.WriteLine("Tien dien: "+(s-t)*542.45);
Console.WriteLine("********************************");
Console.Read();
//by Zero
-----------------------------------------------
1.5
Console.WriteLine("Nhap ho ten:");
string ten = Console.ReadLine();
Console.WriteLine("Chi so dien ke thang truoc");
string sotrct = Console.ReadLine();
Console.WriteLine("Chi so dien ke thang sau");
string sosau = Console.ReadLine();
int t = Int16.Parse(sotrct);
int s = Int16.Parse(sosau);
double tiendien = (s - t) * 542.45;
Console.WriteLine("********************************");
Console.WriteLine(" Hoa don tien dien");
Console.WriteLine("Khac hang: " + ten);
Console.WriteLine("Chi so cu: " + t);
Console.WriteLine("Chi so moi:" + s);
Console.WriteLine("Tieu thu: " + (s - t));
Console.WriteLine("Tien dien: " + tiendien);
Console.WriteLine("Tien thue dien ke: 12.426d/thang");
Console.WriteLine("Tien phu thu 10% tien dien: " +0.1*tiendien);
Console.WriteLine("Tong tien: " + (0.1 * tiendien+12426+tiendien));
Console.WriteLine("********************************");
Console.Read();
//by Zero
-----------------------------------------------
1.7
Console.WriteLine("Chuong trinh giai phuong trinh ax+b=0");
Console.WriteLine("Nhap a,b,c: ");
double a = Double.Parse(Console.ReadLine());
double b = Double.Parse(Console.ReadLine());
if (a == 0)
{
Console.WriteLine("Ban nhap a chua dung, khong phai la phuong trinh bac nhat!!!");
Console.ReadLine();
}
else { Console.WriteLine("Nghiem cua phuong trinh la: "+(-b/a));
Console.ReadLine();}
//by Zero
-----------------------------------------------
1.8
Console.WriteLine("Chuong trinh tinh chu vi va dien tich hinh tron tuong ung");
Console.WriteLine("Nhap ban kinh cua duong tron");
float r = Single.Parse(Console.ReadLine());
float cv = 2 * (float)Math.PI * r;//co the double cv = 2 * Math.PI * r;
float dt = (float)Math.PI * r * r;//co the double dt = Math.PI * r * r;
Console.WriteLine("Chu vi cua duong tron la: " + cv);
Console.WriteLine("Dien tich cua hinh tron tuong ung la: " + dt);
Console.ReadLine();
//by Zero
-----------------------------------------------
1.9
Console.WriteLine("Nhap HO cua nguoi nhan:");
Console.WriteLine("Nhap TEN cua nguoi nhan:");
string h1 = Console.ReadLine();
string t1 = Console.ReadLine();
Console.WriteLine("Nhap HO cua nguoi gui:");
Console.WriteLine("Nhap TEN cua nguoi gui:");
string h2 = Console.ReadLine();
string t2 = Console.ReadLine();
Console.Clear();
Console.SetCursorPosition(5, 1);
Console.WriteLine("Than gui {0} {1}",h1,t1);
Console.WriteLine("Nhan dip sinh nhap cua {0}, cho phep {1} goi den {2} nhung loi chuc tot dep nhat ve suc khoe, hanh phuc va thanh cong trong moi linh vuc.",t1,t2,t1);
Console.CursorLeft = 5;
Console.WriteLine("Gui loi tham suc khoe hai bac cua {0}.", t1);
Console.CursorLeft = 20;
Console.WriteLine("Ban cua {0}", t1);
Console.CursorLeft = 20;
Console.WriteLine(h2+t2);
Console.CursorLeft = 5;
Console.WriteLine("TB: Ba ma {0} thuong nhac den {1} lun", t2,t1);
Console.Read();
//by Zero
-----------------------------------------------
1.10
Console.WriteLine("Chuong tinh tien tiet kiem");
Console.WriteLine("Tien goi: ");
double t = Double.Parse(Console.ReadLine());
Console.WriteLine("Lai suat % (tinh theo thang): ");
double l = Double.Parse(Console.ReadLine());
Console.WriteLine("Thoi gian gui (thang): ");
double tg = Double.Parse(Console.ReadLine());
double tien = t + tg*t * (l / 100);
Console.WriteLine("Tien cua ban sau {0} thang la {1}", tg, tien);
Console.ReadLine();
//by Zero
-----------------------------------------------
1.13
Console.Write(" Qui Ong (Ba):");
String t = Console.ReadLine();
Console.Write(" So ngay o:");
int songay = Int16.Parse(Console.ReadLine());
Console.Write(" So bua an:");
int tieno = Int16.Parse(Console.ReadLine());
Console.Write(" Tien o");
int sobuaan = Int16.Parse(Console.ReadLine());
Console.Write(" Tien an");
int tienan = Int16.Parse(Console.ReadLine());
Console.Write(" Phi phuc vu");
int phucvu = Int16.Parse(Console.ReadLine());
int tongcong = songay * tieno + sobuaan * tienan + phucvu;
Console.Write("Tong " + tongcong);
Console.Clear();
Console.WriteLine("***************************************");
Console.WriteLine(" Khac san Five Stars");
Console.WriteLine(" Hoa don khach san");
Console.WriteLine(" Qui ong ba: " + t);
Console.WriteLine(" So ngay o: {0} So bua an: {1}", songay, sobuaan);
Console.WriteLine(" Tien o: {0} Tien an: {1} Phi phuc vu: {2}", tieno, tienan,phucvu);
Console.WriteLine(" Tong cong: " + tongcong);
Console.WriteLine("***************************************");
Console.Read();
//by Zero
-----------------------------------------------
1.14 cach 1
Console.WriteLine("Nhap X: ");
double y = Int16.Parse(Console.ReadLine());
double z=y*y;
double t = Math.Round(1/y,2);
double e = Math.Round(Math.Sqrt(y),2);
double f = Math.Round(Math.Sqrt(e),2);
Console.WriteLine("\tBang ke so tu {0} den {1}\n\n", y, y + 5);
Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}", y, z, t, e, f);
y++;
t = Math.Round(1 / y, 2);
z = y * y;
e = Math.Round(Math.Sqrt(y), 2);
f = Math.Round(Math.Sqrt(e), 2);
Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}", y, z, t, e, f);
y++;
t = Math.Round(1 / y, 2);
z = y * y;
e = Math.Round(Math.Sqrt(y), 2);
f = Math.Round(Math.Sqrt(e), 2);
Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}", y, z, t, e, f);
y++;
t = Math.Round(1 / y, 2);
z = y * y;
e = Math.Round(Math.Sqrt(y), 2);
f = Math.Round(Math.Sqrt(e), 2);
Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}", y, z, t, e, f);
y++;
t = Math.Round(1 / y, 2);
z = y * y;
e = Math.Round(Math.Sqrt(y), 2);
f = Math.Round(Math.Sqrt(e), 2);
Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}", y, z, t, e, f);
y++;
t = Math.Round(1 / y, 2);
z = y * y;
e = Math.Round(Math.Sqrt(y), 2);
f = Math.Round(Math.Sqrt(e), 2);
Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}", y, z, t, e, f);
Console.ReadLine();
//by Zero
-----------------------------------------------
1.14 cach 2
Console.WriteLine("Nhap X: ");
double x = Int16.Parse(Console.ReadLine());
double y = x - 1;
Console.WriteLine("\tBang ke so tu {0} den {1}\n\n", x, x + 5);
double z, t, e, f;
int j = (int)y;
for (int i = 1; i<=j+5; i++)
{ y++;
z = y * y;
t = Math.Round(1 / y, 2);
e = Math.Round(Math.Sqrt(y), 2);
f = Math.Round(Math.Sqrt(e), 2);
Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}", y, z, t, e, f);
}
Console.ReadLine();
//by Zero
-----------------------------------------------
1.15
Console.WriteLine("Nhap so lon nhot ban mua: ");
int x=Int16.Parse(Console.ReadLine());
int d=x%3;
int r=(x-d)/3;
Console.WriteLine("Ban duoc thuong {0} cai non",r);
Console.WriteLine("Ban duoc thuong {0} cay viet",d*2);
Console.WriteLine("Ban phai tra so tien la {0} voi don gia 27000/lon", x * 27000);
Console.ReadLine();
Console.WriteLine("Ten cua ban la gi?");
string ten = Console.ReadLine();
Console.WriteLine("Ban sinh nam bao nhieu?");
string t = Console.ReadLine();
int namsinh = Int16.Parse(t);
int tuoiht = 2009 - namsinh;
int tuoitl = 2010 - namsinh;
Console.Clear();
Console.Write("Ten ban la {0}\nHien nay ban {1} tuoi\nDen nam 2010 ban {2} tuoi", ten, tuoiht, tuoitl);
Console.ReadLine();
//by Zero
-----------------------------------------------
1.2
Console.WriteLine("Tinh gia tri bieu thuc Y=2*3+4*x-7");
Console.WriteLine("Nhap gia tri x=?");
string x = Console.ReadLine();
int bien = Int16.Parse(x);
int y = 4 * bien - 1;
Console.Write("Gia tri cua Y= " + y);
Console.Read();
//by Zero
-----------------------------------------------
1.3
Console.WriteLine("Chuong trinh tinh gia tri bieu thuc\tP(x,y)=4x*x-2xy+6x*y*y-13");
Console.WriteLine("Nhap cac gia tri x,y");
string x1 = Console.ReadLine();
string x2 = Console.ReadLine();
int x = Int16.Parse(x1);
int y = Int16.Parse(x2);
int p=4*x*x-2*x*y+6*x*y*y-13;
Console.WriteLine("Bieu thuc co gia tri P = " + p);
Console.Read();
//by Zero
-----------------------------------------------
1.4
Console.WriteLine("Nhap ho ten:");
string ten = Console.ReadLine();
Console.WriteLine("Chi so dien ke thang truoc");
string sotrct = Console.ReadLine();
Console.WriteLine("Chi so dien ke thang sau");
string sosau = Console.ReadLine();
int t = Int16.Parse(sotrct);
int s = Int16.Parse(sosau);
Console.WriteLine("********************************");
Console.WriteLine(" Hoa don tien dien");
Console.WriteLine("Khac hang: "+ten);
Console.WriteLine("Chi so cu: "+ t);
Console.WriteLine("Chi so moi:"+s);
Console.WriteLine("Tieu thu: "+(s-t));
Console.WriteLine("Tien dien: "+(s-t)*542.45);
Console.WriteLine("********************************");
Console.Read();
//by Zero
-----------------------------------------------
1.5
Console.WriteLine("Nhap ho ten:");
string ten = Console.ReadLine();
Console.WriteLine("Chi so dien ke thang truoc");
string sotrct = Console.ReadLine();
Console.WriteLine("Chi so dien ke thang sau");
string sosau = Console.ReadLine();
int t = Int16.Parse(sotrct);
int s = Int16.Parse(sosau);
double tiendien = (s - t) * 542.45;
Console.WriteLine("********************************");
Console.WriteLine(" Hoa don tien dien");
Console.WriteLine("Khac hang: " + ten);
Console.WriteLine("Chi so cu: " + t);
Console.WriteLine("Chi so moi:" + s);
Console.WriteLine("Tieu thu: " + (s - t));
Console.WriteLine("Tien dien: " + tiendien);
Console.WriteLine("Tien thue dien ke: 12.426d/thang");
Console.WriteLine("Tien phu thu 10% tien dien: " +0.1*tiendien);
Console.WriteLine("Tong tien: " + (0.1 * tiendien+12426+tiendien));
Console.WriteLine("********************************");
Console.Read();
//by Zero
-----------------------------------------------
1.7
Console.WriteLine("Chuong trinh giai phuong trinh ax+b=0");
Console.WriteLine("Nhap a,b,c: ");
double a = Double.Parse(Console.ReadLine());
double b = Double.Parse(Console.ReadLine());
if (a == 0)
{
Console.WriteLine("Ban nhap a chua dung, khong phai la phuong trinh bac nhat!!!");
Console.ReadLine();
}
else { Console.WriteLine("Nghiem cua phuong trinh la: "+(-b/a));
Console.ReadLine();}
//by Zero
-----------------------------------------------
1.8
Console.WriteLine("Chuong trinh tinh chu vi va dien tich hinh tron tuong ung");
Console.WriteLine("Nhap ban kinh cua duong tron");
float r = Single.Parse(Console.ReadLine());
float cv = 2 * (float)Math.PI * r;//co the double cv = 2 * Math.PI * r;
float dt = (float)Math.PI * r * r;//co the double dt = Math.PI * r * r;
Console.WriteLine("Chu vi cua duong tron la: " + cv);
Console.WriteLine("Dien tich cua hinh tron tuong ung la: " + dt);
Console.ReadLine();
//by Zero
-----------------------------------------------
1.9
Console.WriteLine("Nhap HO cua nguoi nhan:");
Console.WriteLine("Nhap TEN cua nguoi nhan:");
string h1 = Console.ReadLine();
string t1 = Console.ReadLine();
Console.WriteLine("Nhap HO cua nguoi gui:");
Console.WriteLine("Nhap TEN cua nguoi gui:");
string h2 = Console.ReadLine();
string t2 = Console.ReadLine();
Console.Clear();
Console.SetCursorPosition(5, 1);
Console.WriteLine("Than gui {0} {1}",h1,t1);
Console.WriteLine("Nhan dip sinh nhap cua {0}, cho phep {1} goi den {2} nhung loi chuc tot dep nhat ve suc khoe, hanh phuc va thanh cong trong moi linh vuc.",t1,t2,t1);
Console.CursorLeft = 5;
Console.WriteLine("Gui loi tham suc khoe hai bac cua {0}.", t1);
Console.CursorLeft = 20;
Console.WriteLine("Ban cua {0}", t1);
Console.CursorLeft = 20;
Console.WriteLine(h2+t2);
Console.CursorLeft = 5;
Console.WriteLine("TB: Ba ma {0} thuong nhac den {1} lun", t2,t1);
Console.Read();
//by Zero
-----------------------------------------------
1.10
Console.WriteLine("Chuong tinh tien tiet kiem");
Console.WriteLine("Tien goi: ");
double t = Double.Parse(Console.ReadLine());
Console.WriteLine("Lai suat % (tinh theo thang): ");
double l = Double.Parse(Console.ReadLine());
Console.WriteLine("Thoi gian gui (thang): ");
double tg = Double.Parse(Console.ReadLine());
double tien = t + tg*t * (l / 100);
Console.WriteLine("Tien cua ban sau {0} thang la {1}", tg, tien);
Console.ReadLine();
//by Zero
-----------------------------------------------
1.13
Console.Write(" Qui Ong (Ba):");
String t = Console.ReadLine();
Console.Write(" So ngay o:");
int songay = Int16.Parse(Console.ReadLine());
Console.Write(" So bua an:");
int tieno = Int16.Parse(Console.ReadLine());
Console.Write(" Tien o");
int sobuaan = Int16.Parse(Console.ReadLine());
Console.Write(" Tien an");
int tienan = Int16.Parse(Console.ReadLine());
Console.Write(" Phi phuc vu");
int phucvu = Int16.Parse(Console.ReadLine());
int tongcong = songay * tieno + sobuaan * tienan + phucvu;
Console.Write("Tong " + tongcong);
Console.Clear();
Console.WriteLine("***************************************");
Console.WriteLine(" Khac san Five Stars");
Console.WriteLine(" Hoa don khach san");
Console.WriteLine(" Qui ong ba: " + t);
Console.WriteLine(" So ngay o: {0} So bua an: {1}", songay, sobuaan);
Console.WriteLine(" Tien o: {0} Tien an: {1} Phi phuc vu: {2}", tieno, tienan,phucvu);
Console.WriteLine(" Tong cong: " + tongcong);
Console.WriteLine("***************************************");
Console.Read();
//by Zero
-----------------------------------------------
1.14 cach 1
Console.WriteLine("Nhap X: ");
double y = Int16.Parse(Console.ReadLine());
double z=y*y;
double t = Math.Round(1/y,2);
double e = Math.Round(Math.Sqrt(y),2);
double f = Math.Round(Math.Sqrt(e),2);
Console.WriteLine("\tBang ke so tu {0} den {1}\n\n", y, y + 5);
Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}", y, z, t, e, f);
y++;
t = Math.Round(1 / y, 2);
z = y * y;
e = Math.Round(Math.Sqrt(y), 2);
f = Math.Round(Math.Sqrt(e), 2);
Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}", y, z, t, e, f);
y++;
t = Math.Round(1 / y, 2);
z = y * y;
e = Math.Round(Math.Sqrt(y), 2);
f = Math.Round(Math.Sqrt(e), 2);
Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}", y, z, t, e, f);
y++;
t = Math.Round(1 / y, 2);
z = y * y;
e = Math.Round(Math.Sqrt(y), 2);
f = Math.Round(Math.Sqrt(e), 2);
Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}", y, z, t, e, f);
y++;
t = Math.Round(1 / y, 2);
z = y * y;
e = Math.Round(Math.Sqrt(y), 2);
f = Math.Round(Math.Sqrt(e), 2);
Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}", y, z, t, e, f);
y++;
t = Math.Round(1 / y, 2);
z = y * y;
e = Math.Round(Math.Sqrt(y), 2);
f = Math.Round(Math.Sqrt(e), 2);
Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}", y, z, t, e, f);
Console.ReadLine();
//by Zero
-----------------------------------------------
1.14 cach 2
Console.WriteLine("Nhap X: ");
double x = Int16.Parse(Console.ReadLine());
double y = x - 1;
Console.WriteLine("\tBang ke so tu {0} den {1}\n\n", x, x + 5);
double z, t, e, f;
int j = (int)y;
for (int i = 1; i<=j+5; i++)
{ y++;
z = y * y;
t = Math.Round(1 / y, 2);
e = Math.Round(Math.Sqrt(y), 2);
f = Math.Round(Math.Sqrt(e), 2);
Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}", y, z, t, e, f);
}
Console.ReadLine();
//by Zero
-----------------------------------------------
1.15
Console.WriteLine("Nhap so lon nhot ban mua: ");
int x=Int16.Parse(Console.ReadLine());
int d=x%3;
int r=(x-d)/3;
Console.WriteLine("Ban duoc thuong {0} cai non",r);
Console.WriteLine("Ban duoc thuong {0} cay viet",d*2);
Console.WriteLine("Ban phai tra so tien la {0} voi don gia 27000/lon", x * 27000);
Console.ReadLine();