I would include the following code lines in bold to your code. It should work.
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int num,juan_i,juan_p;
cout<< "Put a whole number"<<endl;
cin>> num;
if (num >= 1) //Use if statement as a filter to filter out negative numbers that are less than 0.
{
juan_i = 0;
cout<<endl;
while (juan_i<=20)
{
juan_p = juan_i*num;
cout<<juan_i<<" x "<<num<<" = "<<juan_p<<endl;
juan_i=juan_i+1;
}
else
{
cout << "That is not a valid number!" << endl; // Use this as else statement, you can write anything saying that the number has to be positive.
}
return 0;
}