0% found this document useful (0 votes)
44 views

STMT Types

There are three types of statements in programming: expression statements, control statements, and compound statements. Expression statements include assignments, function calls, and goto statements and always end with a semicolon. Control statements like if, for, while are used to change program flow and may or may not end with a semicolon. Compound statements contain multiple statements within curly braces and never end with a semicolon.

Uploaded by

sonu1070
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

STMT Types

There are three types of statements in programming: expression statements, control statements, and compound statements. Expression statements include assignments, function calls, and goto statements and always end with a semicolon. Control statements like if, for, while are used to change program flow and may or may not end with a semicolon. Compound statements contain multiple statements within curly braces and never end with a semicolon.

Uploaded by

sonu1070
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

TYPES OF STATEMENTS

Expression Statements-
These statements include symbol assignments, function call & transfer of control
using goto statement. These statements are always terminated with a semicolon.
Ex:-
(i) x=a*b;
(ii) printf(“sum=%d”,a+b);
(iii) goto next;

We can write two expressions in the same line. Semicolon is not statement terminator but
separator.

Control Statements-
These statements are used for changing the flow of control within a program.
Various control statements are:-
if, if…..else, for, while, do…..while , switch.

Control statements may or may not end with a semicolon.

Compound Statements-
It is a collection of one or more expression statements and control statements. The
compound statement is enclosed within {}. A compound statement never ends with a
semicolon.
Ex:-
if(d>0)
{
X1=(-b + sqrt(d)) / (2*a);
X1=(-b - sqrt(d)) / (2*a);
}

You might also like