第十课

一、
Console.WriteLine("1~100中所有不能被7整除的数有:");
int sum=0;
int num = 0;
for(int i=1; i<=100; i++)
{
if(i % 7!=0)
{
sum += i;
num++;
Console.Write(i + "\t");
}
if (num == 4)
{
Console.WriteLine();
num = 0;
}
}
Console.WriteLine(" ");
Console.WriteLine ("数据之和为{0}",sum);
Console.ReadKey();
【第十课】二、
try
{
Console.Write("请输入等腰三角形的行数:");
int number = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i <= number; i++)
{
for (int j = 1; j <= number - i; j++)
{
Console.Write(" ");
}
for (int a = 1; a <= 2 * i - 1; a++)
{
Console.Write("*");
}
Console.WriteLine( );
}
}
catch
{
Console.WriteLine("您输入的程序错误");
}
Console.ReadKey();

    推荐阅读