Hello Friends once again Welcome to thenewthink.com Today in this topic we will see that in C language a>etc.Statements What is?, flow Control Statement
Introducation of Statements
Statement type of instruction. Which interrupt the computer to perform various types of tasks. At the end of each statement in programming language ‘C’ ; (semicolon) sign is used. To write more than one statement in one unit, curly brackets {} are used. The statement written in this way is called Compound < /span>Like –is called.Statement
{
Statement 1 ;
Statement 2 ;
:
Statement n ;
}
Flow Control Statement
There are three types of statements in the program.
- Sequential Statements (Sequential Statements)
- Selection/decision Statements (decisional statements)
- Looping Statements (Looping Statements)
Sequential Statements
These are the general Statements of the program which are written one by one from top to bottom (i.e. the order in which they are written). execute
Selection/decision Statements
Decision Statement is a part of the program in which the instruction is executed according to one or more conditions. It depends on the conditions. Programming LanguageThere are four types of decision statements in C.
- if Statment
- switch Statement
- Conditional operator Statement (? 🙂
- goto Statement
Looping Statements
Repeated execution of any part of the program until a particular condition is fulfilled is called looping. It can be understood that when we execute one or more statements more than once, then we use looping in the program. . Through this, the execution of any part of the program continues repeatedly as long as the given condition remains true.
These are of three types.
- for Loop
- while Loop
- do – while Loop
if statement
If Statement is programmed to perform instructions based on the program condition. To write if Statement , after the keyword if the condition is written in small brackets (). After this the instruction is written between the middle brackets {}. If the condition is true then the related instructions are executed or the Statement written after this is executed. Its simple syntax is as follows.
if(condition) { statement 1; statement 2; } statement -x;
if statement flow charts
![](https://web.archive.org/web/20220326053407im_/https://i0.wp.com/thenewthink.com/wp-content/uploads/2022/03/if-statement-.jpg?resize=436%2C327&ssl=1)
Program : Find out the biggest value among two number
#include<stdio.h> #include<conio.h> void main() { int a=50, b=20; clrscr(); if(a>b) { printf("A is greater than of B "); } }
Output :
A is greater than of B
if…else Statement:
This is an extended form of if statement . Under this, the instruction is executed when the condition is true. On the contrary, even if the condition is false, the other desired instruction is executed. Its simple syntax is as follows.
if(condition) { true-bock or set of statements } else { False-block or Set of Statements } Statement -x;
![](https://web.archive.org/web/20220326053407im_/https://i0.wp.com/thenewthink.com/wp-content/uploads/2022/03/if-else-statement.jpg?resize=512%2C384&ssl=1)
Program : Find out the biggest value among two number
#include<stdio.h> #include<conio.h> void main() { int a=50, b=20; clrscr(); if(a<b) { printf("A is greater than of B "); } else{ printf("B is greater than of A "); } }