Assume that an integer value is already stored in x.
Write a conditional statement that will print "Yes" if x is not an exact multiple of 3 and "No" otherwise.
Proper indentation is required for full marks.
The conditional operator or turnory operator ( ? : ) is used to represent conditional statement.
If the condition is true, it will executes first statement else executes second statement.
Here to check x is multiple of 3, condition is x % 3 == 0
So if it is true, it will print yes else it will print no.
So, conditional statement fro the same is
print("yes") if x % 3 == 0 else print("no")
You can write the same statement in C is as follows
x % 3 == 0 ? printf("yes") : printf("no")
Get Answers For Free
Most questions answered within 1 hours.