


























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An introduction to programming languages, their types (low-level, middle-level, and high-level), applications, and specific examples using the C language and its procedural programming paradigm. It covers the basics of structured programming, pre-defined functions, data types, and control statements such as conditionals and loops.
Typology: Assignments
1 / 34
This page cannot be seen from the preview
Don't miss anything!



























Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Prog102: Procedural Programming Submission date Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Student ID Class Assessor name Student declaration I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that making a false declaration is a form of malpractice. Student’s signature Hieu Grading grid P1 P2 P3 M1 M2 D
r Summative Feedback: Resubmission Feedback: Grade: Assessor Signature: Date: Lecturer Signature:
Figure 1 C programming languages .............................................................................................................. 5 Figure 2 C language ....................................................................................................................................... 7 Figure 3 ......................................................................................................................................................... 8 Figure 4 ......................................................................................................................................................... 8 Figure 5 ....................................................................................................................................................... 11 Figure 6 ....................................................................................................................................................... 12 Figure 7 ....................................................................................................................................................... 13 Figure 8 ....................................................................................................................................................... 13 Figure 9 ....................................................................................................................................................... 18 Figure 10 ..................................................................................................................................................... 18 Figure 11 ..................................................................................................................................................... 19 Figure 12 ..................................................................................................................................................... 20 Figure 13 ..................................................................................................................................................... 20 Figure 14 ..................................................................................................................................................... 21 Figure 15 ..................................................................................................................................................... 22 Figure 16 ..................................................................................................................................................... 22 Figure 17 ..................................................................................................................................................... 23 Figure 18 ..................................................................................................................................................... 25 Figure 19 ..................................................................................................................................................... 26 Figure 20 ..................................................................................................................................................... 28 Figure 21 ..................................................................................................................................................... 29 Figure 22 ..................................................................................................................................................... 31 Section 1 : Introduction to programming languages A programming language is a form of computer language that is used to write software, scripts, or instructions for the computer to follow. There are many programming languages in use today. Although the languages also have similarities, each language has its own syntax to use. The job of the programmer is that they have to learn the rules, syntax and structure of the language, then write the source code in an editor or IDE and compile the code into machine language that the computer can understand.. Scripting
This is an intermediate programming language between high-level programming language and low-level programming language, also known as intermediate programming language. The language is both user-friendly and can communicate close to the machine. For example: C, C++ are two typical intermediate languages.
A programming language redesigned to be easy to read, understand, write and maintain for the development of natural language friendly software, application programs or websites. A high-level programming language would require a compiler to translate into machine language for the machine to understand. There are three main types in high-level programming languages: ▪ Procedural Oriented programming language ▪ Object-Oriented Programming language ▪ Natural language Applications of programming languages in life: ▪ Software and application development ▪ Building artificial intelligence ▪ Database Development ▪ Website construction
C language is a procedural programming language. It was initially developed programming language to write an operating system. The main features of the C language include low-level memory access, a simple set of keywords, and a clean style, these features make C language suitable for system programmings like an operating system or compiler development.It extremely popular, simple, and flexible to use. It is a structured programming language that is machine-independent and extensively used to write various applications, Operating Systems like Windows, and many other complex programs like Oracle database, Git, Python interpreter, and more.
Figure 2 C language
Procedural programming is the way to implement the above function- oriented approach. The procedural approach divides a large program (function) into blocks of functions or functions (procedures) that are small enough to be easy to program and test. Each function has a start and an end point and has its own data and logic. In a program system, variables have certain visible scopes. In a program, functions work independently of each other. Data is converted back and forth through function call parameters. Dividing a program into functions allows multiple people to participate in the
B. Advantages and Disadvantages of Procedural Programming a) Advantage ▪ Procedural Programing is a great way to program in general. ▪ The code simplicity,as well as ease with which compilers and interpreters can be implemented ▪ A wide range of book and online course materials on tried algorithm are available,making it easier to learn as you go. ▪ The code can be reused without having to copy it in various sections of software ▪ The program flow can be tracked easily. b) Disadvantages ▪ If Procedural Programming is used , the program code is more difficult to writer. ▪ The Procedural code is often not reusable whichmay pose the need to recreate the code if need to use another application ▪ Diffcult to relate with real-world objects. ▪ The Process is prioritzed over the data ,which can cause problem in data-sensitive situation. ▪ The data is exposed to whole program, making it not so much security friendly.
Structured programming is a programming paradigm aimed at improving the clarity, quality, and development time of a computer program by making extensive use of the structured control flow constructs of selection (if/then/else) and repetition (while and for), block structures, and subroutines. Structured programming is a program written with only the structured programming constructions: (1) sequence, (2) repetition, and (3) selection.
▪ (1)Sequence. Lines or blocks of code are written and executed in sequential order. ▪ (2)Repetition. Repeat a block of code (Action) while a condition is true. ▪ (3)Selection. Characteristics, Properties : Program = Data structure + Algorithm Data structure : ▪ Data structure: how to describe, organize data ▪ Algorithm: algorithm, steps to solve the problem The basic properties of structured programming are: ▪ Focus on the work to be done (algorithms) ▪ A large program is divided into subroutines, each of which can be called one or more times in any order. A large program is divided into subroutines, each of which can be called one or more times in any order. A large program is divided into subroutines, each of which can be called one or more times in any order. ▪ Most functions use common data ▪ Data in the system is moved from one function to another. ▪ Function that converts data from one form to another ▪ Using a top-down approach in program design Advantages and Defect : Advantages: ▪ Provides an ability to reuse the same code at various places. ▪ Facilitates in tracking the program flow. ▪ Capable of constructing modules. Defect:
Figure 6
A variable is data name that may used to store a data value and it may be s word or variable name. A variable is nothing but a name given to a storage area that our programs can manipulate. Each variable in C has a specific type, which determines the size and layout of the variable's memory; the range of values that can be stored within that memory; and the set of operations that can be applied to the variable. The name of a variable can be composed of letters, digits, and the underscore character. It must begin with either a letter or an underscore. Upper and lowercase letters are distinct because C is case-sensitive. Based on the basic types explained in the previous chapter, there will be the following basic variable types.
Sr.No. Type & Description 1 char Typically a single octet(one byte). It is an integer type. 2 int The most natural size of integer for the machine. 3 float A single-precision floating point value. 4 double A double-precision floating point value. 5 void Represents the absence of type. Example 1 : Figure 7 Example 2 : Figure 8
unsigned char 1 byte 0 to 255 signed char 1 byte - 128 to 127 int 2 or 4 bytes
Type Storage size Value range Precision float 4 byte 1.2E-38 to 3.4E+38 6 decimal places double 8 byte 2.3E-308 to 1.7E+308 15 decimal places long double 10 byte 3.4E-4932 to 1.1E+4932 19 decimal places Based on the problem you gave me, I will create variables and set their data types as follows :
How "if..else" statement works.. ▪ (^) If the expression is evaluated to nonzero (true) then if block statement(s) are executed. ▪ (^) If the expression is evaluated to zero (false) then else block statement(s) are executed. 3) Nestled if statement: The nested if...else statement is used when a program requires more than one test expression. It is also called a multi-way selection statement. When a series of the decision are involved in a statement, we use if else statement in nested form. Syntax of Nestled if statement: Figure 11 4) If..else If ladder : The if-else-if statement is used to execute one code from multiple conditions. It is also called multipath decision statement. It is a chain of if..else statements in which each if statement is associated with else if statement and last would be an else statement. Syntax if-else-if statement :