2018-10-25运算符

1.半径为5的圆
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
int r = 5;
double pi = 3.14;
double total1 = pi * r * r;
double total2 = pi * 2 * r;
Console.WriteLine("面积是{0},周长是{1}", total1, total2);
Console.ReadKey();

    }
}

}

2.语数英成绩
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("请输入你的姓名");
string name=Console.ReadLine();

        Console.WriteLine("请输入你的语文成绩");
        string str_Chinese = Console.ReadLine();
        double chinese = Convert.ToDouble(str_Chinese);

        Console.WriteLine("请输入你的数学成绩");
        string str_Math= Console.ReadLine();
        double math = Convert.ToDouble(str_Math);

        Console.WriteLine("请输入你的英语成绩");
        string str_English = Console.ReadLine();
        double english = Convert.ToDouble(str_English);

        int Chinese = Convert.ToInt32(str_Chinese);
        int Math = Convert.ToInt32(str_Math);
        int English = Convert.ToInt32(str_English);

        //总分
        int total = Chinese + Math + English;
       
        //平均分
        double avg = total / 3.0;

        Console.WriteLine("总共应付:{0},平均分是:{1}", total,avg);
        
        Console.ReadKey();
        

    }
}

}

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容