Code Snippets C

#include
#include
int main(void)
{
int magic;
int guess;
magic = rand(); /* get a random number */
printf("Guess the magic number: ");
scanf("%d", &guess);
if (guess == magic) {
printf("Right");
printf(" %d is the magic number\n", magic);
}
else {
printf("Wrong, ");
if(guess > magic) printf("too high\n"); /* nested if */
else printf("too low\n");
}
return 0;
}