gpt-3.5-turbo-0301· openai
from WildChat-4.8M
/* Prompt the user to enter a number and read in the input / printf("Enter an integer…
- User
/* Prompt the user to enter a number and read in the input */ printf("Enter an integer between 1 and 100 (inclusive): "); scanf("%d", &num);
/* Keep asking for the input until a valid integer is entered */ while (num < 1 || num > 100) { printf("Invalid input. Enter an integer between 1 and 100 (inclusive): "); scanf("%d", &num); }
/* Check whether the input is even or odd and print out a message */ if (num % 2 == 0) { printf("%d is even.\n", num); } else { printf("%d is odd.\n", num); }
return 0;
- Assistant
}