int x = 1;
int sum = 0;//和,初始化为0
while (x <= 30)//循环条件
{
sum += x;
x++;
}
Console.Write("1-30奇数的和:" + (sum - (5 * 3)) / 2);
int sum = 0;//和,初始化为0
while (x <= 30)//循环条件
{
sum += x;
x++;
}
Console.Write("1-30奇数的和:" + (sum - (5 * 3)) / 2);
2016-03-25
int x = 1;
int sum = 0;//和,初始化为0
while (x <= 30)//循环条件
{
if (x%2!=0){//筛选条件
sum += x;
}
x++;
}
Console.Write("1-30奇数的和:"+sum);
int sum = 0;//和,初始化为0
while (x <= 30)//循环条件
{
if (x%2!=0){//筛选条件
sum += x;
}
x++;
}
Console.Write("1-30奇数的和:"+sum);
2016-03-25
int x = 1;
int sum = 0;//和,初始化为0
while (x <= 30)//循环条件
{
if (x%2!=0)//筛选条件
sum += x;
x++;
}
Console.Write("1-30奇数的和:"+sum);
int sum = 0;//和,初始化为0
while (x <= 30)//循环条件
{
if (x%2!=0)//筛选条件
sum += x;
x++;
}
Console.Write("1-30奇数的和:"+sum);
2016-03-24
int[] score = { 90,79,67,88,60,99,100,65};
string[] name = {"Amy","Tom","Jack","Alice","Mark","Sun","King","Davie" };
int avg, sum = 0;
for (int i = 0; i < score.Length; i++)
{
sum += score[i];
}
string[] name = {"Amy","Tom","Jack","Alice","Mark","Sun","King","Davie" };
int avg, sum = 0;
for (int i = 0; i < score.Length; i++)
{
sum += score[i];
}
题目要求:输出结果为4
即 x-y的值要求为4,程序已经给出了x的值为 x/=0.5,即x=4。那么y的值只能是0.
以上,可知 使y取余或者减2都可以满足.
即 x-y的值要求为4,程序已经给出了x的值为 x/=0.5,即x=4。那么y的值只能是0.
以上,可知 使y取余或者减2都可以满足.
2016-03-24