using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace ConsoleApplication1
{
    class Program 
    {
        static void Main(string[] args)
        {
            Console.WriteLine("hello word!");
            int a1 = 23, a2 = 24;
            Console.WriteLine(a1);
            Console.WriteLine(a1 / a2);
            Console.WriteLine(a1 * a2);
            Console.WriteLine(a1 % a2);
                                         Console.ReadKey();
        }
    }
}
请教,这个输出出来这样了啊?23
0
552
23

解决方案 »

  1.   

    不能使用整形。整形5/3=1,自动把小数位四舍五入掉了。
      

  2.   

    纠正一下,不是四舍五入,是直接去掉小数位了。
      

  3.   

    23/24 等于 0,这是软件编程基本,属于计算机原理的知识。不是说会除法,就理解计算机的除法原理了。你一定要有一堂课学点计算机原理。
      

  4.   

    在计算机的指令系统中,往往本身就有这类除法指令,计算机本来就是用来设计为23/24为0这类计算的。反倒是我们要跟数学保持一致,才把它搞成浮点数再去除,则会比23/24慢不知多少倍了。