pupesko

SoftUni - 3.2 Float or Double

Oct 26th, 2015
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  1. //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.
  2.  
  3. using System;
  4.  
  5. namespace FloatorDouble
  6. {
  7.     class FloatorDouble
  8.     {
  9.         static void Main()
  10.         {
  11.             double daysSum = 34.567839023;
  12.             Console.WriteLine(daysSum);
  13.  
  14.             float twelveSum = 12.345f;
  15.             Console.WriteLine(twelveSum);
  16.  
  17.             double numSum = 8923.1234857;
  18.             Console.WriteLine(numSum);
  19.  
  20.             float coffeeSum = 3456.091f;
  21.             Console.WriteLine(coffeeSum);
  22.  
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment