Promise this is the last time I'm going to pick your guys brain for a while..
OK...the program is suppose to find out if a ticket number is valid or not. What happens is the last digit of number must match the remainder when the other digits - as a group - are divided by 7.
It then says at the bottom not to read the number in a single step, but to read the digits one-by-one w/ getchar.
Apprrantly I am doing something wrong though. Any advice?
Code:#include <stdio.h> main () { char ch; int i=0; int count=0; printf("Enter ticket number: "); while ( ( ch = getchar() ) != '\n' ) { count++; i = 7 % ch; } if ( (ch / count) == i ) printf("VALID"); else printf("Not a valid ticket!"); }