100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4,6 TrustPilot
logo-home
Resumen

Summary c programming statements

Puntuación
-
Vendido
-
Páginas
7
Subido en
18-01-2026
Escrito en
2025/2026

This document contains c programming statements with detailed information

Institución
Grado









Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Escuela, estudio y materia

Institución
Estudio
Desconocido
Grado

Información del documento

Subido en
18 de enero de 2026
Número de páginas
7
Escrito en
2025/2026
Tipo
Resumen

Temas

Vista previa del contenido

UNIT-2 STATEMENTS
A statement is a part of your program that can be executed. That is, a statement specifies an action. Statements
generally contain expressions and end with a semicolon.
Statements that are written individually are called Single/Simple statements. Statements that are written as a
block are called Block/Compound statements. A block begins with an open brace { and ends with a closing
brace }.
C categorizes statements into these groups:
 Selection / Branch / Decision making / Conditional statements
 Loop/ Iteration/ Repetitive statements
 Jump / Control transfer statements
 Expression Statements
 Block statements/ compound statements
SELECTION STATEMENTS:
A selection statement checks the given condition and decides the execution of statements after the success or
failure of the condition. C supports two selection control statements if and switch.
1. If statement: The if statement is a decision making statement that allows the computer to evaluate an
expression (condition) first and depending on the result of the condition i.e. true or false, it transfers the control
to a particular statement.
The if statement has the following forms
a) Simple if Statement
b) if...else Statement
c) Nested if Statement
d) if..else Ladder Statement
Simple if Statement
The simple if statement contains only one condition, if the condition is true, it will execute the statements that
are present between opening and closing braces. Otherwise it will not execute those statements.
Syntax: Example:
if(condition) /* A program to check whether a number is Less than 100 or not */
Single-statement #include<stdio.h>
OR #include<conio.h>
if(condition) void main()
{ {
Statement-block int a;
} clrscr();
printf("enter an integer ");
scanf("%d",&a);
if(a<=10)
printf("%d is less than 100",a); getch();
}
if...else Statement
This statement is used to define two blocks of statements in order to execute only one block. If the condition is
true, the block of if is executed; otherwise, the block of else is executed.
Syntax: Example:
if (condition) Write a program to check whether the given number is a positive number or a
{ negative number
True Block Statements; #include<stdio.h>
------------- #include<conio.h>
} void main()
else {
{ int n;
False Block Statements; clrscr();

, ------------ printf("enter any number ");
} scanf("%d",&n);
if(n>=0)
{
printf("\n %d is a positive number",n);
}
else
{
printf("\n %d is a negative number",n);
}
getch();
}

Nested if –else Statement
When an if statement is placed in another if statement or in else statement, then it is called nested if statement.
The nested if-else is used when a series of decisions are involved. In a nested if-else, an else statement
always refers to the nearest if statement which is within the same block as the else and that is not already
associated with an else.
Syntax: Example:
if (condition) Write a program to finding greatest among three numbers
{ #include<stdio.h>
if(condition) #include<conio.h>
{ void main()
True Block Statements; {
------------- int a,b;
} clrscr();
} printf("enter any two number ");
else scanf("%d%d",&a,&b);
{ if(a>b)
False Block Statements; {
------------ if(a>c)
} printf(“ %d is greatest”,a);
else
printf(“ %d is greatest”,c);
}

else
{
if(b>c)
printf(“ %d is greatest”,b);
else
printf(“ %d is greatest”,c);
}
getch();
}

if..else Ladder Statement
The if-else ladder is used when multipath (multiple) decisions are involved.
A multipath decision is a chain of if-elses in which the statement associated with each else is an if-statement.
$7.66
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada

Conoce al vendedor
Seller avatar
tabassumy

Documento también disponible en un lote

Conoce al vendedor

Seller avatar
tabassumy
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
Nuevo en Stuvia
Miembro desde
2 semanas
Número de seguidores
0
Documentos
17
Última venta
-

0.0

0 reseñas

5
0
4
0
3
0
2
0
1
0

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes