1,977
社区成员
发帖
与我相关
我的任务
分享
float[] num = new float[10];
float sum = 0.0f, average;
for (int i = 0; i < 10; i++)
{
num[i] = Convert.ToSingle(Console.ReadLine());
sum += num[i];
}
average = sum / 10;
Console.WriteLine("The Average is {0}", average);
for (int i = 0; i < 10; i++)
{
if (num[i] < average)
{
Console.WriteLine(num[i]);
}
}
double a, b, c, s, x;
a = Convert.ToDouble(Console.ReadLine());
b = Convert.ToDouble(Console.ReadLine());
c = Convert.ToDouble(Console.ReadLine());
if ((a + b) > c && (a + c) > b && (b + c) > a)
{
x = (a + b + c) / 2;
s = Math.Sqrt(x * (x - a) * (x - b) * (x - c));
Console.WriteLine("三角形的面积为:{0}", s);
}
else
{
Console.WriteLine("输入三边不能形成三角形!");
}
int i;
for(i=0;i<=200;i++)
{
if(i%2!=0)
{
Console.WriteLine("素数:{0}",i);
}
}
int a = 15;
int b = 20;
int c = 30;
if(a+b>c&&a+c>b&&b+c>a)
{
double temp,result;
temp=(a+b+c)/2;
result=sqrt(temp*(temp-a)*(temp-b)*(temp-c));
}
int a, b, c, max;
a = Convert.ToInt32(Console.ReadLine());
b = Convert.ToInt32(Console.ReadLine());
c = Convert.ToInt32(Console.ReadLine());
max = a > b ? a : b;
max = max > c ? max : c;
Console.WriteLine("The max number is {0}",max);
Console.ReadLine();