The simplest if structure involves a single executable statement. Execution of the statement occurs only if the condition is true.
Syntax:
if (condition)
statement;
#include<stdio.h>
#include<conio.h>
void main ()
{
int marks;
clrscr();
{
printf("Enter your marks:");
scanf("%d",&marks);
if(marks >=50)
printf("CONGRATULATIONS...!!! you have passed.");
}
getch();
}
Limitation of if statementThe statement(s) are executed if the condition is true; if the condition is false nothing happens in other words we may say it is not the effective one. Instead of it we use if-else statements etc.
Limitation of if statementThe statement(s) are executed if the condition is true; if the condition is false nothing happens in other words we may say it is not the effective one. Instead of it we use if-else statements etc.

No comments:
Post a Comment