Write a program which will calculate, for every integer that is being input, a code in the following way

first digit multiplied by 3

plus

second digit multiplied with the third digit

minus

fourth digit

thus the number 3124(of type int) should generatethe code 7, because 3*3 +1*2 - 4=7.

you may assume that the given integers will all consist of four digits. submit printouts of the program and output with he six integers below as input. use a for loop iterating from 1 to 6. NB: You may not input the digits separately, but should input the number as a whole. (hint:Use / and % in the calculation.)

3255

1067

1393

2892

1111

2020

i tried this program below but it gives me (-2answer)

please help me

```
#include <iostream>
using namespace std;
int main( )
//Initialize integers
{
int number,first,second,third,fourth,answer;
//For loop
for(int x=1;x <= 6;x++)
//Input of number from user
cout << "Enter in number: ";
cin >> number,first,second,third,fourth;
//Get the first digit in the thousands place
first = number / 1000;
number = number % 1000;
//Get the second digit in the hundreds place
second = number / 100;
number = number % 100;
//Get the third digit in the tens place
third = number / 10;
number = number % 10;
//Remaining is the ones place
fourth = number;
//Calculate and give answer
answer = first *3+second *third -fourth ;
cout << "Your aswer is" << answer;
cin >> answer;
return 0;
}
```