Professional Documents
Culture Documents
Cs Chapter 3 Plan 3
Cs Chapter 3 Plan 3
Chapter no: 03
Introduction:
Main Content:
In C, a statement terminator is a symbol that indicates the end of a statement. The
most commonly used statement terminator is the semicolon ;. It is placed at the end
of a C statement to signify the completion of that particular statement. Every
statement in C must end with a semicolon, except for control statements like if, else,
for, and while, where the statement block is enclosed within curly braces.
int main() {
int a = 5; // statement ending with a semicolon
printf("Hello, World!"); // statement ending with a semicolon
return 0; // statement ending with a semicolon
}
In C, format specifiers are placeholders used within formatted input and output
functions to represent the type and format of the data being processed. Format
specifiers begin with the percent sign % and are followed by a character that
indicates the type of data. Some common format specifiers used in C include:
For example
int num = 10;
float floatValue = 3.14;
char letter = 'A';
Provide code snippets with missing or incorrect statement terminators and 05 minutes
format specifiers. Ask students to identify and correct the errors in the
provided code.
Review the solutions and discuss the significance of using proper statement
terminators and format specifiers for error-free programming.
Student Activities:
Divide students into small groups and provide them with scenarios that require 05 minutes
the use of different format specifiers. Ask them to propose appropriate format
specifier usage for the given scenarios.
Recap:
Summarize the key points about the use of statement terminators and format
05 minutes
specifiers in C programming and their significance in ensuring proper syntax and data
formatting.
Homework / Worksheets:
RFERENCE: