I have a number stored as a double
and want to print it without the decimal places. So if I had the double value 919545634521.000000
, it is always printed with the decimal places added to it. How can I print it without it so it looks like: 919545634521
?
#include<stdlib.h>
int main()
{
double number = 9220343120;
printf("%??\n", number);
}
try
printf("%.0lf\n",phoneNum);
you may also prefer
long long phoneNum;
phoneNum = strtoll(buffer,NULL,0);
printf("%lld\n",phoneNum);
instead. Depending on the system, though, you may need other function to convert (I think it's _strtoui64
for windows).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With