Identify possible pair of factors from a product This is my first C++ program (not counting "hello world") and I'd like to know if there are some semantic mistakes or if I could rewrite the code in a more simple way.

It performs brute-force factorisation of the number provided on standard input.

Here is the code:

#include &lt;iostream&gt;
#include &lt;cstdio&gt;
using namespace std;

int main() {
    int f1 = 0;
    int f2 = 0;
    int p;
    int increment = 1;
    cin &gt;&gt; p;
    if ((f1 &amp;&amp; f2) == p) {
        cout &lt;&lt; f1 &lt;&lt; "x" &lt;&lt; f2 &lt;&lt; "=" &lt;&lt; p;
    }
    else if (p &lt; 00) {
        cout &lt;&lt; "Insert a positive number";
    }

    while (
        ( (f1 &amp;&amp; f2) != p) &amp;&amp; (f1 &lt; p) &amp;&amp; (f2 &lt;= p) ) {

        f1++;
        if (f1 * f2 == p) {
            cout &lt;&lt; f1 &lt;&lt; "x" &lt;&lt; f2 &lt;&lt; "=" &lt;&lt; p &lt;&lt; "\n";
        }
        f2 = increment;
        if (f1 == p) {
            increment++;
                f1 = 0;
        }
    }
    system("pause");
        return 0;
    }


Thanks for your feedback!
Don't using namespace std; - this namespace isn't designed for wholesale import like that.

Import &lt;cstdlib&gt; to declare std::system() - though note that almost any use of this function makes your code highly platform-specific (that just gives a sh: pause: not found error here, for example).

Never ignore the return value from std::system or from streaming with &gt;&gt;.

Error messages should go to std::cerr and end with a newline (and we should return early in the error case, rather than continuing to the while loop).

if ((f1 &amp;&amp; f2) == p) is a highly unconventional way of writing if (p == 0).  Don't make it unnecessarily hard to read.

In the while condition, (f1 &amp;&amp; f2) != p) can only be false when p is 1, so just treat that case separately, before the loop.

Prefer pre-increment (++x) to post-increment (x++) in C++ code when not using the result.  Here, with integers, the compiler can optimize to the same code, but with more complex types, that's not always possible.