0

# When to use float and integer?

5 Answers

+ 1

float when you need a decimal. integer when you need a whole number
example
integer for counting number of people (you cant have a fraction of a person)
float for calculating area of a circle
also, i prefer using double instead of float

+ 1

yea you can use int instead of float, as 10 and 20 are whole numbers

+ 1

it should work. try it and check again for errors

0

float a =10;
float b = 20;
float c = a+b;
console.WriteLine (c);
console.ReadKey ( );
can i use int instead of float here??
but if i do so it's not working

0

yeah working thank u so much :)