how can i print 19.5 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how can i print 19.5

hi please help me, when i want to print 19.5, on the screen, it just show me 19 or when i want to print 18.25, on the screen, it just show me 18 my code is : #include <iostream> using namespace std; int main() { int number; cout<<"enter your number\n"; cin>>number; cout<<number; return 0; } please tell me what to do thanks

20th Jul 2016, 2:09 PM
Reza Sarvani
Reza Sarvani - avatar
2 Answers
+ 2
use float in place of int
20th Jul 2016, 2:12 PM
Mukul Kumar
Mukul Kumar - avatar
0
thanks a lot
20th Jul 2016, 2:14 PM
Reza Sarvani
Reza Sarvani - avatar