one more quick question, this isn't complicated but somehow i'm causing infinnite loop when i attempt it. given the following code...
starting after the first printf i need everything else to loop, any ideas using a nested loop? thanks!
starting after the first printf i need everything else to loop, any ideas using a nested loop? thanks!
Code:
#inclde<stdio.h>
#define START_CHAR ' '
#define END_CHAR '.'
int check_sum(int sum);
int main(void) {
int char_code,sum,checksum,x;
char letter;
printf("Enter a message ending in a period; or a period only to quit.\n\n");
for(sum = 0; char_code != (int)END_CHAR; sum += char_code) {
scanf(" %c", &letter);
char_code = (int)letter;
}
checksum = check_sum(sum);
printf("Checksum: %c %d\n", (char)checksum, (int)checksum);
return(0);
}
Comment