Question: I'm new to C and trying to learn as best I can. I have this problem which I solved and the logic works pretty good, but whenever there is a wrong input it shows the message on screen and plus that the condition is not true. So whenever there is supposed to be an Invalid Input message I also get NE - which is what it would print out if the condition isn't true.

This is the code:

```
#include <stdio.h> 
#include <stdlib.h>

int main() {
    int a, b;
    scanf("%d %d", &a, &b);
    if(a <= 0 || b <= 0) {
        printf("Invalid input");
    } else {
        if(a < b) {
            int tmp = a;
            a = b;
            b = tmp;
        }
    }
    a/=10;
    int c1,c2;
    while (a!=0 && b!=0){
        c1 = a%10;
        c2 = b%10;
        a /= 100;
        b /= 10;
    }
    if (c1 == c2)
        printf("PAREN\n");
    else
        printf ("NE\n");
    return 0;
}

```

Answer: 
Its because there is nothing thats stop it to do so:

If you just want to terminate your program just `return` whenever if condition is true: 

```
if(a <= 0 || b <= 0) {
printf("Invalid input");
return 1;
 } 

```

Alternative: Just add rest of the code under `else` clause.
Either you add a `return` statement as suggested in other answers, or you **include everything that should happen for valid input in the first `else` clause** (in other words, just move the closing brace of the first `else` clause, just before the closing brace of your `main` function.)