习题01 : 从键盘上输入两个数,由用户输入他们的和与平均值. 要求如下:
1. 输入和/平均值 程序返回判断结果;
2. 如果和正确, 就再次提示平均值, 如果平均值正确,就再次提示和;
3. 输入尝试次数到达三次,提示3次到了程序结束;
4. 输入和/平均值都正确, 提示和/平均值都正确, 程序结束;
如果是你,你会怎么做呢 ?
下列代码使用了goto等暴力代码,逻辑流交叉繁复, 肯定不够简洁;
循环也不是很好做; 大家有建议欢迎分享;
using System;
using System.Threading;
using System.Xml.Schema;
namespace ConsoleApp04
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
Console.WriteLine("input the first number");
int num1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("input the second number");
int num2 = Convert.ToInt32(Console.ReadLine());
int i = 0;
int a = 0;
int b = 0;
Total:
Console.WriteLine("input the total number");