Test C#
Test C#
Code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace test
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Nhap vao n ban muon : ");
int n = int.Parse(Console.ReadLine());
for (int i = 0; i < n; i++)
{
Console.WriteLine(i);
}
}
}
}
Bài 3 :Đáp án C : Đảm bảo an toàn của lớp khi thiết kế.
Bài 4
Code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace test
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hay nhap vao so a : ");
int a = int.Parse(Console.ReadLine());
Console.WriteLine("Hay nhap vao so b : ");
int b = int.Parse(Console.ReadLine());
Console.WriteLine("Hay nhap vao so c : ");
int c = int.Parse(Console.ReadLine());
Console.WriteLine("Pt nhap vao la : " + a+"x + "+b+"y + "+c + " = 0 ");
}
}
}
Bài 5 :
Code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace test
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hay nhap vao n phan tu cua cap so cong : ");
int n = int.Parse(Console.ReadLine());
Console.WriteLine("Hay nhap vao so cua phan tu u1 cua cap so cong : ");
int u1 = int.Parse(Console.ReadLine());
Console.WriteLine("Hay nhap vao cong sai cua cap so cong : ");
int d = int.Parse(Console.ReadLine());
Console.WriteLine("------------------------------");
Console.WriteLine("Tong cua cap so cong la : n = u1 * d = " + (n = u1*(n - 1)*d));
}
}
Bài 6 :
Code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace test
{
class Program
{
static void Main(string[] args)
{
int i, j, k, soluong = 0;
for (i = 0; i <= 50 ; ++i)
for (j = 0; j <= 25; ++j)
for (k = 0; k <= 10 ; ++k)
if (i * 10000 + j * 20000 + k * 50000 == 500000)
{
Console.WriteLine("Tong cong can " + i + " to 10000 va " + j + " to 20000 va "
+ k + " to 50000 de dc tong la 500k ");
soluong++;
}
Console.WriteLine("Co tat ca la : " + soluong + " cach chon ");
}
}
Bài 7 :
Code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace test
{
class Program
{
static void Main(string[] args)
{
Console.Write("Nhap vao so KW ban can xem : ");
float n = float.Parse(Console.ReadLine());
Bài 8 :
Code :