(Lecture 1) NAOE2214 CLASS 1 Introduction To Programming (Partial)
(Lecture 1) NAOE2214 CLASS 1 Introduction To Programming (Partial)
Attendance 10%
Assignment/Report 20%
Quiz 40%
Total 100%
All of the students are instructed to start their zoom meeting with a name of
his student ID.
For example: Student with St/ID 18411001 must enter the meeting with a
meeting ID of 18411001.
NAOE 2214: Computer Programming for
4 Engineers 9/3/2020
How C Works
• Executing a program written in C involves following steps:
• For the peoples who want to run their codes on the go try
the CppDroid app
Header file
Identifier
refers to name given to entities such as variables, functions,
structures etc. Identifiers must be unique. They are created to give
a unique name to an entity to identify it during the execution of the
program.
Data types
In C programming, data types are declarations for variables. This
determines the type and size of data associated with variables.
General form
type variable-name;
Example:
int year;
float weight;
char grade;
Statement output
printf(“String”);
Example # 2
Write a program that will display the following line
“The use of Mobile phones or pen drives is strictly
prohibited during the class time”
TIME: 2 MINUTES
# include <stdio.h>
void main(void)
{
printf(“ %s is %d million miles away”, “Venus”, 67);
printf(“from the sun.”, “Venus”, 67);
}
# include <stdio.h>
void main(void)
{
printf(“ %s is %d million miles away \n from the sun.”, “Venus”,
67);
}
void main(void)
{
int event = 5;
char heat = „A‟;
float time = 27.25;
Format Output
printf(“%d”, 9876); 9 8 7 6
printf(“%6d”, 9876); 0 0 9 8 7 6
printf(“%2d”, 9876); 9 8 7 6
printf(“%-6d”, 9876); 9 8 7 6
printf(“%06d”, 9876); 0 0 9 8 7 6