Int, float, double, decimal

image_pdfimage_print

   

/*
Learning C# 
by Jesse Liberty

Publisher: O'Reilly 
ISBN: 0596003765
*/
 using System;
 public class IntFloatDoubleDecValues
 {
     static void Main()
     {
         int firstInt, secondInt;
         float firstFloat, secondFloat;
         double firstDouble, secondDouble;
         decimal firstDecimal, secondDecimal;

         firstInt = 17;
         secondInt = 4;
         firstFloat = 17;
         secondFloat = 4;
         firstDouble = 17;
         secondDouble = 4;
         firstDecimal = 17;
         secondDecimal = 4;
         Console.WriteLine("Integer:	{0}
float:		{1}",
             firstInt/secondInt, firstFloat/secondFloat);
         Console.WriteLine("double:		{0}
decimal:	{1}",
             firstDouble/secondDouble, firstDecimal/secondDecimal);
         Console.WriteLine(
           "
Remainder(modulus) from integer division:	{0}",
             firstInt%secondInt);

     }
 }