Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //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;
- namespace FloatorDouble
- {
- class FloatorDouble
- {
- static void Main()
- {
- double daysSum = 34.567839023;
- Console.WriteLine(daysSum);
- float twelveSum = 12.345f;
- Console.WriteLine(twelveSum);
- double numSum = 8923.1234857;
- Console.WriteLine(numSum);
- float coffeeSum = 3456.091f;
- Console.WriteLine(coffeeSum);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment