int num1 = 1;
int num2 = 50;
int addition = num1 + num2;
Chat with our AI personalities
Floating type numbers can't be stored in integer type variables. If we do that then their fractional part will be lost. So, we use float data type to store numbers with fractional parts.
In Java, you can use either a float or a double
Decimal numbers are real numbers. In C and C++ we use the float, double and long double data types to represent real numbers.
Yes, an integer can be assigned as a float value.But it get stored as a float value, that is an implicit type conversion occurs during compilation.Smaller data types are convertible to larger data types.eg:float b=12;// an integer constant is assigned to a float variableprintf("%f",b);// when printing b it will print as 12.000000
i wann't ask the range of double float and long double float??