You are on page 1of 3

ARMY Burn HALL COLLEGE FOR BOYS

CLASS: 10th LESSON PLAN # 3.3

SUBJECT: Computer Science DATE:

Chapter no: 03

Name of Chapter: Input and Output Handling

Topic: Statement terminator, format specifiers

No. Of lessons required 02

Related practical: Implementation of Format Specifiers

Recap: Time: 40 minutes

Objectives / Learning Outcomes:

 Understand the role of the statement terminator in demarcating the end of a


statement in C.
 Learn about format specifiers and their significance in formatting input and
output data.
 Explore the usage of statement terminators and format specifiers in C
programming.

Training Aids / AV Aids:

 Whiteboard and markers


 Code snippets in C demonstrating the use of statement terminators and
format specifiers
 Visual aids illustrating the role of format specifiers in input and output 05 minutes
formatting

Introduction:

 Discuss the importance of statement terminators in C and their role in defining


the end of a statement.
20 minutes
 Introduce the concept of format specifiers and their significance in controlling
the input and output formatting in C programming.

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:

 %d: Used for formatting and printing integers.


 %f: Used for formatting and printing floating-point numbers.
 %c: Used for formatting and printing characters.
 %s: Used for formatting and printing strings.

For example
int num = 10;
float floatValue = 3.14;
char letter = 'A';

printf("Integer: %d\n", num);


printf("Float: %f\n", floatValue);
printf("Character: %c\n", letter);
In the printf function, the format specifiers are used to define the data type of the
corresponding variables. When the function is executed, these format specifiers are
replaced with the actual values of the variables, formatted according to the specified
data type.
Assessment:

 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:

You might also like