#include <iostream>
int main()
{
//Returns Seven divided by three is 2
std::cout << "Seven divided by three is " << 7/3 << std::endl;
//Return Seven divided by three is 2.33333
std::cout << "Seven divided by three is " << 7.0/3 << std::endl;
std::cout << "Seven divided by three is " << 7.0/3.0 << std::endl;
}
How does adding .0
to the end of a number return a decimal answer even though I have not put a float or double variable in the code?