0
0
C Sharp (C#)programming~10 mins

Floating point types (float, double, decimal) in C Sharp (C#) - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to declare a variable of type float.

C Sharp (C#)
[1] number = 3.14f;
Drag options to blanks, or click blank then click option'
Afloat
Bvar
Cdouble
Ddecimal
Attempts:
3 left
💡 Hint
Common Mistakes
Using double or decimal keyword instead of float.
Forgetting the 'f' suffix on the number.
2fill in blank
medium

Complete the code to declare a variable of type double.

C Sharp (C#)
[1] value = 3.14159;
Drag options to blanks, or click blank then click option'
Adecimal
Bvar
Cdouble
Dfloat
Attempts:
3 left
💡 Hint
Common Mistakes
Using float keyword without suffix 'f'.
Using decimal keyword which requires suffix 'm'.
3fill in blank
hard

Complete the code to declare a variable of type decimal.

C Sharp (C#)
[1] price = 19.99m;
Drag options to blanks, or click blank then click option'
Afloat
Bdecimal
Cvar
Ddouble
Attempts:
3 left
💡 Hint
Common Mistakes
Using float or double keyword with 'm' suffix.
Omitting the 'm' suffix for decimal literals.
4fill in blank
hard

Fill both blanks to declare a float and a decimal variable correctly.

C Sharp (C#)
float pi = [1][2];
decimal cost = 9.99m;
Drag options to blanks, or click blank then click option'
A3.14
B3.14f
Cf
Dm
Attempts:
3 left
💡 Hint
Common Mistakes
Putting the suffix before the number.
Using 'm' suffix for float.
5fill in blank
hard

Fill all three blanks to declare variables of float and double types correctly.

C Sharp (C#)
[1] f = 3.5[2];
[3] d = 6.7;
Drag options to blanks, or click blank then click option'
A3.5f
Bf
Cdouble
Dfloat
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'float' keyword for double variable.
Omitting 'f' suffix for float literal.