I created a program that calculates the divisibility by 3 and 5. If divisible by 3 print 'CS' and if divisible by 5 print 'CS1714'. If divisible by both print 'CS1714'. If not divisible by 3 or 5 print 'ERROR'.
My code executes properly. However is it possible for the Boolean && to break if say both values are false. Also why does the code print 'CSERROR' when input is 98988?
#include <stdio.h>
int main(void)
{
int userInput;
scanf("%d", &userInput);
if((userInput % 3) == 0){
printf("CS");
}
if((userInput % 5) == 0){
printf("1714");
}
else if(!((userInput % 5) == 0 && (userInput % 3) == 0)){
printf("ERROR");
}
return 0;
}