-->

Facebook

Jasper Roberts - Blog

Monday, March 2, 2015

Simple if statement.

-In C programming language, c provides if statement to take one way decision.

-If the condition is true than it will execute the statement(s) otherwise it will not execute the statement(s).

Syntax:
          if(condition)
                 statement(s);
if statement theory
simple if statement


-Simple if statement provides only one way decision.
 -If the statements are more than one than it will be written in { and } braces.

Example:
#include<conio.h>
#include<stdio.h>

void main()
{
     float per;
     clrscr();
     printf("enter the percentage:");
     scanf("%f",&per);

   if(per>=35)
            printf("Congratulations!!");

   getch();
}

OUTPUT:
enter the percentage: 40
Congratulations!!

RELATED TOPICS
if...else statement.
if...else if ladder(multiple if else).
Switch...case Statement in C programming language.

1 comment:

  1. thanks for this code, this is most important concepts in c language......again thanks.

    ReplyDelete