Program 16 #P16 -C Program to display a number if user enters negative number #C128
How if statement works?
The if statement evaluates the test expression inside the parenthesis.
If the test expression is evaluated to true nonzero, statements inside the body of if is executed.
If the test expression is evaluated to false 0, statements inside the body of if is skipped from execution.
When user enters -2, the test expression number less than 0 is evaluated to true. Hence, You entered -2 is displayed on the screen.
When user enters 5, the test expression number less than 0 is evaluated to false and the statement inside the body of if is skipped.
In programming, decision making is used to specify the order in which statements are executed. In this tutorial, you will learn to write if...else statements to make decisions in your program.
#rubalsolutions #coding #developer #programming #programmer #technology #clanguage #computerscience #c #informaticpractices #sub #subscribe #youtube #newyoutuber #youtubechannel