Q.1. What is the difference between if and if-else loop?
Q.2. Write the syntax of if-else statement?
Q.3. Draw the flowchart of if and if-else statements?
Q.4. Write a program to check if the number is positive, zero or negative. Then print an appropriate
message. Also, ask the user to input a number? Using if...elif...else.
Answers
Explanation:
1) With the if statement, a program will execute the true code block or do nothing. With the if/else statement, the program will execute either the true code block or the false code block so something is always executed with an if/else statement.
2) if (test expression) {
// statements to be executed if the test expression is true
}
else {
// statements to be executed if the test expression is false
}
3) it's in the above diagram
4) number = int(input("Enter number: "))
# checking the number
if number < 0: print("The entered number is negative.") elif number > 0:
print("The entered number is positive.")
elif number == 0:
print("Number is zero.")
else:
print("The input is not a number")
I hope it helps
please mark it as BRAINLIEST