# Target C

• Hello, please tell me what this is going to look like on C, wrote on a pascal, like, all right, but I don't know how to get it on C. Thank you.

This is the challenge.

Three of the buddies witnessed traffic violations. The number of the car is four-digit, no one remembers. From their testimony, it appears that the number is divided into two, seven and 11, only two digits are included in the record, the number is 30 digits. Make an algorithm and a program to define the vehicle number

• I didn't think of anything but a stupid chisel. That's the cold.

``````#include <stdio.h>
#include <stdbool.h>
bool cond (int x) {
int number;
int n1=-1, n2=-1, res=0;
while (x > 0){
number=x%10;
x /= 10;
if (n1==-1){
n1=number;
}
else {
if (number!=n1){
if (n2==-1) n2=number;
else
if (number != n2)
return false;
}
}
res += number;
}
if (res == 30) return true;
else return false;
}
int main() {
int x=0, n=7;
bool is = false;
while (true) {
x=n27*11;
if (x >9999) break;
if (cond(x)) {
printf ("Number = %d\n", x);
is=true;
}
n++;
}
if (!is){
printf ("No result\n");
}
return 0;
}
``````

Some elements of the C99 are used here. I hope your compiler supports him.

2

2

2

2

2

2

2

2

2

2

2

2

2

2

2