Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace TypesForMoney
- {
- class Program
- {
- static void Main(string[] args)
- {
- int i = 1;
- float f = 1f;
- double d = 1d;
- decimal m = 1m;
- Console.WriteLine(i); //1
- Console.WriteLine(f); //1
- Console.WriteLine(d); //1
- Console.WriteLine(m); //1
- Console.WriteLine(i.ToString("C")); //$1.00
- Console.WriteLine(f.ToString("C")); //$1.00
- Console.WriteLine(d.ToString("C")); //$1.00
- Console.WriteLine(m.ToString("C")); //$1.00
- i /= 10;
- f /= 10;
- d /= 10;
- m /= 10;
- Console.WriteLine(i.ToString("G20")); //0
- Console.WriteLine(f.ToString("G20")); //0.100000001
- Console.WriteLine(d.ToString("G20")); //0.10000000000000001
- Console.WriteLine(m.ToString("G20")); //0.1
- Console.Read();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement