Podcast
Questions and Answers
Naina has written a program in which she has entered one number. She wants to check whether the entered number is divisible by 2 or not. Suggest her the appropriate condition for the same.
Naina has written a program in which she has entered one number. She wants to check whether the entered number is divisible by 2 or not. Suggest her the appropriate condition for the same.
Naina should use the condition 'if (number % 2 == 0)' to check whether the entered number is divisible by 2. If the remainder when dividing the number by 2 is 0, then the number is divisible by 2.
Neha wants to check multiple conditions to perform an action. Suggest her the appropriate control structure for doing the same.
Neha wants to check multiple conditions to perform an action. Suggest her the appropriate control structure for doing the same.
Neha should use the 'if-else' control structure to check multiple conditions and perform the appropriate action based on the evaluation of each condition.