#include <stdio.h>
int calculator(void *yourVal){
char *byte1;
int byte3, byte5, byte7;
int value;
byte1 = yourVal;
byte3 = (byte1[2] - '0') * 10 + (byte1[3] - '0');
byte5 = (byte1[4] - '0') * 10 + (byte1[5] - '0');
byte7 = (byte1[6] - '0') * 10 + (byte1[7] - '0');
if(*byte1 == '*') {
value = byte3 * byte5 * byte7;
return value;
}
else if(*byte1 == '/') {
//omitted
}
else {
printf("Your input is invalid\n"); }
return 0xBAD;
}
int main (void){
printf("%d\n", calculator
("*1234567")); return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgY2FsY3VsYXRvcih2b2lkICp5b3VyVmFsKXsKCWNoYXIgKmJ5dGUxOwoJaW50IGJ5dGUzLCBieXRlNSwgYnl0ZTc7CglpbnQgdmFsdWU7CgkKCWJ5dGUxID0geW91clZhbDsKCWJ5dGUzID0gKGJ5dGUxWzJdIC0gJzAnKSAqIDEwICsgKGJ5dGUxWzNdIC0gJzAnKTsKCWJ5dGU1ID0gKGJ5dGUxWzRdIC0gJzAnKSAqIDEwICsgKGJ5dGUxWzVdIC0gJzAnKTsKCWJ5dGU3ID0gKGJ5dGUxWzZdIC0gJzAnKSAqIDEwICsgKGJ5dGUxWzddIC0gJzAnKTsKCQoJaWYoKmJ5dGUxID09ICcqJykgewoJCXZhbHVlID0gYnl0ZTMgKiBieXRlNSAqIGJ5dGU3OwoJCXByaW50ZigiWW91IG11bHRpcGxpZWRcbiIpOwoJCXJldHVybiB2YWx1ZTsKCX0KCWVsc2UgaWYoKmJ5dGUxID09ICcvJykgewoJCS8vb21pdHRlZAoJfQoJZWxzZSB7CgkJcHJpbnRmKCJZb3VyIGlucHV0IGlzIGludmFsaWRcbiIpOwoJfQoJcmV0dXJuIDB4QkFEOwp9CgoKaW50IG1haW4gKHZvaWQpewoJcHJpbnRmKCIlZFxuIiwgY2FsY3VsYXRvcigiKjEyMzQ1NjciKSk7CglyZXR1cm4gMDsKfQo=