this is based on a problem from an exercise book i found...
in essence you're supposed to write a program that receives an integer (not necessarily positive), and perform the following check on it:
every digit in an odd place should be odd and vise versa.
so for example:
4723 is fine
3301 is not
digits are counted right to left and there's no restriction to the size of the input.
okay so here's what i got:
the code compiles fine, but the program freezes somewhere after the scanf
int run=1, input, fixed, i=1, mod, check=1;
int sign_fix(int input);
printf("input an integer:\n");
if((fixed%2)==i) // checks whether %2 is even or odd. i changes after every successful incident
printf("YES \n"); //conforms to the requirements
printf("NO \n"); // duh
int sign_fix(int input) // checks whether input is positive or negative and returns accordingly
anyone know what the deal is ?
and, in general, how does one go about solving such problems ?
any tricks ?