第一题
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("第一科成绩:");
int score1 =Convert.ToInt32(Console.ReadLine());
Console.WriteLine("第二科成绩:");
int score2 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("第三科成绩:");
int score3 = Convert.ToInt32(Console.ReadLine());
int total = score1 + score2 + score3;
int avreage = total / 3;
Console.WriteLine("三科总成绩:"+ total.ToString());
Console.WriteLine("三科平均成绩:"+ avreage.ToString());
Console.ReadKey();
}
}
}
第二题:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("输入一个整数:");
int a = Convert.ToInt32(Console.ReadLine());
if (a % 2 == 0)
{
Console.WriteLine("no");
}
else
{
Console.WriteLine("yes");
}
Console.ReadKey();
}
}
}