Float

From Hack Wars Wiki

Jump to: navigation, search

A float is a number containing a decimal point, representing a fraction. Floats, as with other variables, are defined by naming the type, and then giving the variable a name. After the variable has been defined, it can either be initialised on the same line, or further on in the code.

Examples

float float_name = value;

float pi = 3.141;

float pi;
pi = 3.141;

float pi = 3.141;
float r = 25.0;
float area =  pi * r * r;

float area = 3.141 * 25.0 * 25.0;
Personal tools