Why this code doesnt work? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Why this code doesnt work?

const float PI= 3.14; Console.WriteLine(PI); // ERROR const double PI=3.14; Console.WriteLine(PI); // NO ERROR please help me there..

13th Aug 2019, 8:13 AM
DataStream Cowboy
DataStream Cowboy - avatar
3 Réponses
+ 3
All decimals are treated as double by default, to specify a float, suffix the number with an "f". const float pi = 3.142f; // float const double pi = 3.142; // double
13th Aug 2019, 8:23 AM
Dlite
Dlite - avatar
0
D'Lite thanks i got you
13th Aug 2019, 1:20 PM
DataStream Cowboy
DataStream Cowboy - avatar