Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Problem 2. Float or Double?
- //Which of the following values can be assigned to a variable of type float and which to a variable of type double: 34.567839023, 12.345, 8923.1234857, 3456.091? Write a program to assign the numbers in variables and print them to ensure no precision is lost.
- using System;
- class FloatOrDouble
- {
- static void Main()
- {
- double doubleA=34.567839023;
- float floatB=12.345f;
- double doubleC=8923.1234857;
- float floatD=3456.091f;
- Console.WriteLine("Double type are:{0} and {1}",doubleA,doubleC);
- Console.WriteLine("Float type are:{0} and {1}",floatB,floatD);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement