小编Fre*_*red的帖子

C#中的简单数学问题

我有这个程序,每个可能200分中取3分,然后应该得到平均值并显示百分比.但是当我输入数字时,我得到00.0作为答案.我能做错什么?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int Score1;
            int Score2;
            int Score3;

            Console.Write("Enter your score (out of 200 possible) on the first test: ");

            Score1 = int.Parse(Console.ReadLine());
            Console.Write("Enter your score (out of 200 possible) on the second test: ");

            Score2 = int.Parse(Console.ReadLine());
            Console.Write("Enter your score (out of 200 possible on the third test: ");

            Score3 = int.Parse(Console.ReadLine());
            Console.WriteLine("\n");

            float percent = (( Score1+ Score2+ Score3) / …
Run Code Online (Sandbox Code Playgroud)

c# math command-line percentage

5
推荐指数
1
解决办法
966
查看次数

标签 统计

c# ×1

command-line ×1

math ×1

percentage ×1