Float
in
Programming Questions
•
1 year ago
Hey Guys I have a question. My professor gave us this example in class
int total;
float average;
total = 12+25+36+15;
average = total / 4;
print ("The average is ");
print (average);
and the average printed out to 22. However, why did he do float, even is you do int average you get the same answer.
Any help will be greatly appreciated.
Also when do you use float ? And what is float ?
int total;
float average;
total = 12+25+36+15;
average = total / 4;
print ("The average is ");
print (average);
and the average printed out to 22. However, why did he do float, even is you do int average you get the same answer.
Any help will be greatly appreciated.
Also when do you use float ? And what is float ?
1