Did you know conditions are very essentials component of programming. Without conditions we can't able to perform critical task such as identifing which one greater or small, on or off etc. We can't able to compare without conditional statement. In this blogspot we are going show you how to use IF condition in C programming.
In above c program we declared header file stdio then main() function and inside the curly bracket first of all we declared two variables that is int a and int b. Then assigned 10 and 20 value to a and b.
Now we have to check which number is greater. Here is the need of conditional statement. Let's use IF condition. IF condition is the most popular conditional statement. let's write If() and inside the simple bracket add this logic ( b > a ). Which means b is greater than a. When this condition is true then print b is greater. Note that after declaration of IF condition Don't forget to add Curly brackets. Now check output and output is b is greater.
This is how we can use IF condition in c. Hope you understood. If you have any comments please write it below.
Comments
Post a Comment
Please give us feedback through comments