I wrote a program to find the number of digits of an integer, but I always get the wrong result. Could someone point out the error? Here's the source code:(adsbygoogle = window.adsbygoogle || []).push({});

#include <iostream>

#include <cmath>

using namespace std;

int main()

{

int i=53443;

cout<<log(i);

return 0;

}

The log function gives me a weird result each time. I dont know why though. Im using dev c++ compiler...

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# C++ Digit algorithm

Loading...

Similar Threads for Digit algorithm |
---|

Insights Intro to Algorithms for Programming - Comments |

Python Verlet algorithm and Lorentz force trajectory |

C/++/# Is there a flaw in my longest common subsequence algorithm? |

C/++/# Finding duplicates algorithm |

Conditional Digital Feedback; is it a good Idea? (Neural Networks) |

**Physics Forums | Science Articles, Homework Help, Discussion**