type casting
// typecasting syntax
// (type) value
#include <stdio.h>
int main()
{
float a=10;
float b=(float) 54/5; //here int & int will give int so we have to convert it to float for float no
printf("%d\n",(int) a); // here i changed the type of the value a
printf("%f",b);
return 0;
}
Comments
Post a Comment