Advertisement



< Prev
Next >


C - If Statement





In C language, the If statement is used when we want to test a condition, which is evaluated for a boolean value - true or false.




Note:





Advertisement




C - if statement example


/* C - if statement program */

#include <stdio.h>
int main()
{
if(100>5)
	printf("100 is greater than 50 \n");

	
if(50<100)
{
	printf("50 is less than 100 \n");
	printf("Second statement to execute \n");
}


if(2>4)
{
	printf("2 is greater than 4 \n");
}


printf("Statement outside If Statement \n"); /*not associated with any if block*/

return 0;
}


Output is -


100 is greater than 50
50 is less than 100
Second statement to execute
Statement outside If Statement



Program Analysis


Please Subscribe

Please subscribe to our social media channels for daily updates.


Decodejava Facebook Page  DecodeJava Twitter Page Decodejava Google+ Page




Advertisement



Notifications



Please check our latest addition

C#, PYTHON and DJANGO


Advertisement