Question: ![My workspace](https://i.stack.imgur.com/V282Z.png)

At first the MainActivity.java didn't have an error.
I have configed id for button, text fields. And they are added in com.mikeyaworski.basiccalculations

but i don't know what I have done that the project has two R.java in gen package.

one is in package android.support.v7.appcompat.
other is in com.mikeyaworski.basiccalculations (my config is here).

MainActivity.java has an error because cannot find R.layout.activity\_main (because this variable is in com.mikeyaworski.basiccalculations package but i think the project use R.java from package android.support.v7.appcompat) 

what should I do for this problem?

Answer: 
Couple of issues in your code.

* After each time the program encounters a non-numeric character it doesn't read further from the input. It reads the same character. Hence `c=getchar()` should be outside the `if` block
* The multiplication happens for the `char` variable `c`. It should be converted to the actual number and then be multiplied. In your code you are multiplying its ascii value. Hence `(c-48)*i` instead of `c*i`
```
int i,c;

i = 1;

while (i){

    c=getchar();

    if(c == '\n')
    {
        break;
    }

    if (c < 48 || c > 57)
    {
        i = -1;
        break;
    }

    i = i * (c-48);

}

if (i == -1)
{
    printf("Error. Non-Number Entered\n\n");
}

else {

    printf("%d\n\n",i);

}

```