title: How can exit from a int function without returning value in C++?
body: <p>I tried to solve a problem yesterday in c++. The problem was a famous one called "Fizzbuzz". It will take a number as input. For each multiple of 3, print "Fizz". For each multiple of 5, print "Buzz". For numbers which are multiples of both 3 and 5, print "FizzBuzz" instead of the number. If a number which is not multiples of 3, 5 or both it will print the number instead.</p>
  
  <p>An example: If I give 5 as input it will show output like this: <code>12Fizz4Buzz</code>. But the problem is this judge has a template code like the following:</p>
  
  <pre><code>#include&lt;bits/stdc++.h&gt;
  using namespace std;
  int FizzbuzzFunc(int num)
  {
  
  return 0;
  }
  int main()
  {
  int number;
  cin&gt;&gt;number;
  cout&lt;&lt;FizzbuzzFunc(number);
  return 0;
  }
  </code></pre>
  
  <p>Whenever I tried to solve it by putting my code into that "FizzbuzzFunc" It is printing an extra 0 at the end of the output. An example if my code seems like this:</p>
  
  <pre><code>#include&lt;bits/stdc++.h&gt;
  using namespace std;
  int FizzbuzzFunc(int num)
  {
  
  for(int i = 1; i &lt;= num; i++)
  {
  if (i % 3 == 0 &amp;&amp; i % 5 == 0)
  {
  cout&lt;&lt;"FizzBuzz";
  }
  else if(i % 3 == 0)
  {
  cout&lt;&lt;"Fizz";
  }
  else if(i % 5 == 0)
  {
  cout&lt;&lt;"Buzz";
  }
  else
  {
  cout&lt;&lt;i;
  }
  }
  
  return 0;
  }
  int main()
  {
  int number;
  cin&gt;&gt;number;
  cout&lt;&lt;FizzbuzzFunc(number);
  return 0;
  }
  </code></pre>
  
  <p>and take input as 5 then the output will look like this: <code>12Fizz4Buzz0</code>.
  How can I remove that extra 0 from the output?</p>