title: Happy number - Leetcode challenge
body: <p>I've written the code for the * Happy Number * </p>
  
  <p>Whats' a happy number? Example :</p>
  
  <p>Input: 19</p>
  
  <p>Output: true</p>
  
  <p>Explanation: </p>
  
  <p>1^2 + 9^2 = 82</p>
  
  <p>8^2 + 2^2 = 68</p>
  
  <p>6^2 + 8^2 = 100</p>
  
  <p>1^2 + 0^2 + 0^2 = 1  . Those numbers for which this process ends in <strong>1</strong> are happy numbers.</p>
  
  <p>My code:</p>
  
  <pre><code>bool isHappy(int n){
          int sum=0;
          while(n&gt;=10)
          {
              while(n!=0)
              {
                  int r = n%10;
                  sum = sum + (r*r);
                  n = n / 10;
              }
              n=sum;
              sum=0;
          }
          if(n==1)
              return 1;
          else
              return 0;
  }
  </code></pre>
  
  <p>My problem is that when I submit the code , LeetCode says that for the input 7 the ouput  should be <strong>TRUE</strong>.
  How is that even possible? Any number &lt;10 is 100% not Happy , right ? 
  PS : In Code::Blocks everything works fine.
  Anyone else who encountered this ?</p>