C Statements

Decision Making and Branching C Statements:->

We know that  C programs are Sequentially in the order in which they appear but sometimes we need to change the execution of the Program under certain condition.

C Language Provides decision making Statement which are as follows.

 If Statement

 Switch

 Go Statement

 Continue Statement

 

  C Statements if :-

The if statement is a powerful decision making statement. It is used to control the flow of Execution of Statements.

if the condition is true, then the statement block within the if will executed otherwise it will bypass.

Syntax :-

if(condition)

{

statement block;

}

if statement

Example :-

A program using if condition to check the no. is +ve or -ve

#include<stdio.h>

#include<conio.h>

void main()

{

int n;

printf("Enter the No.");

scanf("%d", &n);

if(n>0)

{

printf("No. is Positive");

}

getch();

}

Continue……




Follow Us

Contact Us

tutorialworldin@yahoo.com

Back to Top