typecasting
The conversion of one type of data to another type is called types conversion. When there is some type of data type(int, int) it will produce an answer in int which is auto, but when we need to convert mixed datatype value to another data type(int, float, char, etc.) we use typecasting. typecasting does not change the value but it changes the datatype of a given value or variable. For example, to see the answer of int datatype in float data type, we use typecasting(which if force full). Let's be clear with the given code.
Syntax
datatype expression;
Float b;
Code
Question:- write a program to multiply any two user input integer values and print them in integer as well as in float.
output
enter a value of a: 8
enter a value of b: 5
the floating answer of a given integer is 40.00000
the integer answer of a given integer is 40
0 Comments