Hi guys,
I'm new to these forums( and coding), but I don't really have anybody else to ask;
insert
Code:
do{
printf("CS133 Program 4 Track 2: Printing a calendar. Enter number of days in month:");
scanf("%d", &n);
printf("Enter starting day of the week (1=Sun, 7=Sat):");
scanf("%d", &day);
for (i = 1; i<day; i++) {
printf(" ");
}
for(i = 1; i<=n; i++){
printf("%3d", i);
if (((i + day) % 7)-1 == 0){
printf("\n");
}
printf("Do you want to go again?(y/n)?");
scanf (" %c", &r);
} while (r == 'y');
return 0;
}
This is the code I'm working on for a class. The problem is; it WILL NOT RUN. If I take out the middle loops, the while statement works fine. If I take out the do/while, the middle works fine but together? They give me an "expected declaration or statement at end", if I try adding braces I don't think I need, it ignores the while statement.
I've been working on it for hours and between the book and the internet I can't find the problem. Is it the braces? Too many loop de loops? Where the heck am I going wrong?
If anyone could look it over and tell me where I should focus, I would really appreciate it.