static void Main (string[] args)
{
Const double PI = 3.14;
const int bar_unit_price = 25;
const int brick_unit_price = 85;
Input
int A, B;
Console.Write ("Please enter the pool radius:");
string S1 = Console.ReadLine ();
A = Convert.ToInt32 (S1);
Console.Write ("Please enter the square radius:");
String s2 = Console.ReadLine ();
b = Convert.ToInt32 (s2);
Operation
Double L = 2 * PI * A; Find the perimeter of the pool
Double area1 = PI * A * a;//the area of the pool.
Double AREA2 = PI * b * b;//total area.
Double area = area2-area1;//Square size
Double barprice = l * bar_unit_price; Total cost of guardrail
Double Brickprice = area * brick_unit_price;//square cost.
Output
Console.WriteLine ("The length of the guardrail is" + L + "meters, the total area of the square brick is" + areas + "square meters, the total cost is" + (Barprice + brickprice) + "Yuan");
}
}
}
The second question determines the case of the root of a two-time equation.
static void Main (string[] args)
{int A, b, C; Input Console.Write ("Please enter factor A:");
A = Convert.ToInt32 (Console.ReadLine ());
Console.Write ("Please enter factor B:");
b = Convert.ToInt32 (Console.ReadLine ());
Console.Write ("Please input factor C:");
c = Convert.ToInt32 (Console.ReadLine ());
Operation output
if (a = = 0)
{
Console.WriteLine ("Not a two-dimensional equation");
}
Else
{
int d = b * b-4 * a * C;
if (d > 0)
{
Console.WriteLine ("Two Unequal real roots");
}
else if (d = = 0)
{
Console.WriteLine ("Two Equal real Roots");
}
Else
{
Console.WriteLine ("No real Roots");
}
}
}
}
}
The third question, enter a year to determine whether it is leap years or common year.
static void CCC (string[] args)
{
int year;
Input
Console.Write ("Please enter a year:");
Year = Convert.ToInt32 (Console.ReadLine ());
Operation
Divisible by 400, or divisible by 4, but not divisible by 100.
If ((year% 400 = = 0) | | (year% 4 = = 0 && Year% 100! = 0))
{
Console.WriteLine ("is a leap year");
} else
{
Console.WriteLine ("is common year");
}
}
}
}
For loop ① fence length ② square brick Area ③ Judge Leap year common year