Alternative way for void type help!
Well...This is my code. The question for the tutorial is
Rewrite main so that it tests all the number from 2 to 20 and prints out the results, each on a separate line. (Hint: use for loop, with i running from 2 to 20.
Code:
#include <iostream>
#include <math.h>
using namespace std;
void num(int n);
int main()
{
int m;
num(m);
return 0;
}
void num(int n)
{
int i;
int m = 20;
for(i = 2; i <= m; i++)
cout<< i << endl;
}
I know it does not do what is asked. But here I use void type, and my question if it is possible to use the type integer or something else to do this exercise?