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

Section A

intro to c

Uploaded by

punny
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Section A

intro to c

Uploaded by

punny
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 32

SectionA

Computer Programming
• Computer programming is the process of performing a particular
computation (or more generally, accomplishing a specific computing
result), usually by designing and building an executable
computer program.
• Programming involves tasks such as analysis, generating algorithms,
profiling algorithms' accuracy and resource consumption, and the
implementation of algorithms (usually in a chosen programming language,
commonly referred to as coding).
• The source code of a program is written in one or more languages that are
intelligible to programmers, rather than machine code, which is directly
executed by the central processing unit.
• The purpose of programming is to find a sequence of instructions that will
automate the performance of a task (which can be as complex as an
operating system) on a computer, often for solving a given problem.
Program
• A program is a set of instructions that a computer uses
to perform a specific function.
• A program contains a list of variables,( which can
represent numeric data, text, or images) and a list of
directions (called statements) that tell the computer how
to execute a specific task.
• Programs are created using specific
programming languages such as C++, Python, and Ruby.
• Each programming language has its own collection of
keywords and syntax for constructing a set of
instructions.
Programming Language
• A programming language is a system of notation for writing
computer programs.[
• Programming language is a collection of instructions that the
CPU (Central Processing Unit) assembles to complete a certain
task in a computer.
• Each programming language has its own collection of keywords
and syntax for constructing a set of instructions.
• Programming language can be divided into three categories
based on the levels of abstraction:
• Low-level Language
• High-level Language
• Medium Level Language
Machine Language
• A machine-level language is one that consists of a set of binary instructions
that are either 0 or 1. Because computers can only read machine instructions
in binary digits, i.e., 0 and 1, the instructions sent to the computer must be in
binary codes.
• It is difficult for programmers to write programs in machine instructions,
hence creating a program in a machine-level language is a challenging
undertaking.
• It is prone to errors because it is difficult to comprehend, and it requires a lot
of upkeep.
• Distinct processor architectures require different machine codes;
• A machine-level language is not portable since each computer has its own set
of machine instructions, therefore a program written on one computer will no
longer work on another.
• For example, a PowerPC processor has a RISC architecture, which necessitates
a different code than an Intel x86 processor with a CISC design.
Assembly Language

• Some commands in the assembly language are human-readable, such as


move, add, sub, and so on. The challenges we had with machine-level
language are mitigated to some extent by using assembly language, which is
an expanded form of machine-level language.
• Assembly language instructions are easier to write and understand since they
use English words like move, add, and sub.
• We need a translator that transforms assembly language into machine code
since computers can only understand machine-level instructions.
• Assemblers are the translators that are utilized to translate the code.
• Because the data is stored in computer registers, and the computer must be
aware of the varied sets of registers, the assembly language code is not
portable.
• Because assembly code is higher in the hierarchy than machine code, it is
slower. This indicates that assembly code has some abstraction from the
hardware, but machine code has none.
High-Level Language:

• A high-level language is a programming language that


allows a programmer to create programs that are not
dependent on the type of computer they are running on.
• High-level languages are distinguished from machine-level
languages by their resemblance to human languages.
• When writing a program in a high-level language, the logic
of the problem must be given complete attention.
• To convert a high-level language to a low-level language, a
compiler is necessary.
• Example : c ,c++,java,phython
Advantages of High-level language:

• Because it is written in English like words, the


high-level language is simple to read, write, and
maintain.
• The purpose of high-level languages is to
overcome the drawbacks of low-level
languages, namely portability.
• The high-level language is machine-
independent.
• High-level programming language is portable.
Sum Up
• High level refers to programming languages that are written in
a way that can be understood by a human. They are
independent and programmers don’t need to have any prior
knowledge of the hardware in which the program will be used.
Examples of high-level programming languages include C++
and Python.
• Middle-level languages serve as a bridge between the
hardware and programming layer of a computer. They operate
within the abstraction layer of a computer.
• On the other hand, Low-level languages are written to meet
the needs of particular computer architecture and hardware
requirements.
Programming Development Cycle
• Program development is the process of creating application programs. Program
development life cycle (PDLC) The process containing the five phases of program development:
analyzing, designing, coding, debugging and testing, and implementing and maintaining
application software.
• The following are six steps in the Program Development Life Cycle:
• Analyze the problem. The computer user must figure out the problem, then decide how to resolve the
problem - choose a program.
• Design the program. A flow chart is important to use during this step of the PDLC. This is a visual
diagram of the flow containing the program. This step will help you break down the problem.
• Code the program. This is using the language of programming to write the lines of code. The code is
called the listing or the source code. The computer user will run an object code for this step.
• Debug the program. The computer user must debug. This is the process of finding the "bugs" on the
computer. The bugs are important to find because this is known as errors in a program.
• Formalize the solution. One must run the program to make sure there are no syntax and logic errors.
Syntax are grammatical errors and logic errors are incorrect results.
• Document and maintain the program. This step is the final step of gathering everything together.
Internal documentation is involved in this step because it explains the reasoning one might of made a
change in the program or how to write a program
Details
• https://www.geeksforgeeks.org/software-
engineering-program-development-life-cycle-
pdlc/
Syntax
• Syntax refers to the spelling and grammar of
a programming language. Computers are inflexible
machines that understand what you type only if you type it
in the exact form that the computer expects. The expected
form is called the syntax. Program with syntax errors cannot
execute.
• A logic error (or logical error) is a mistake in a program's
source code that results in incorrect or unexpected behavior.
It is a type of runtime error that may simply produce the
wrong output or may cause a program to crash while
running. Many different types of programming mistakes can
cause logic errors
Flow Chart
• The Flowchart is the most widely used
graphical representation of an algorithm and
procedural design workflows.
• Flow charts are diagrams showing the exact
sequence of logical steps. They use geometrical
shapes and arrows to show processes,
relationships, and data/process flow.
• In other words, flowcharts depict decisions
and results of them.
Rules
• Only conventional flowchart symbols should
be used.
• Proper use of names and variables in the
flowchart.
• If the flowchart becomes large and complex,
use connector symbols.
• Flowcharts should have start and stop points.
Symbols
• Terminal Symbol: In the flowchart, it is
represented with the help of a circle for
denoting the start and stop symbol. The
symbol given below is used to represent the
terminal symbol.
• Input/output Symbol: The input symbol is
used to represent the input data, and the
output symbol is used to display the output
operation. The symbol given below is used for
representing the Input/output symbol.
• Processing Symbol:It is represented in a
flowchart with the help of a rectangle box
used to represent the arithmetic and data
movement instructions. The symbol given
below is used to represent the processing
symbol.
• Decision Symbol: Diamond symbol is used for
represents decision-making statements. The
symbol given below is used to represent the
decision symbol.
• Connector Symbol:The connector symbol is
used if flows discontinued at some point and
continued again at another place. The
following symbol is the representation of the
connector symbol.
• Flow lines: It represents the exact sequence in
which instructions are executed. Arrows are
used to represent the flow lines in a flowchart.
The symbol given below is used for
representing the flow lines:
• Hexagon symbol (Flat): It is used to create a
preparation box containing the loop setting
statement. The symbol given below is used for
representing the Hexagon symbol.
Advantages
• Communication: A flowchart is a better way of communicating the logic of a
program.
• Synthesis: Flowchart is used as working models in designing new programs and
software systems.
• Efficient Coding: Flowcharts act as a guide for a programmer in writing the actual
code in a high-level language.
• Proper Debugging: Flowcharts help in the debugging process.
• Effective Analysis: Effective analysis of logical programs can be easily done with
the help of a related flowchart.
• Proper Documentation: Flowchart provides better and proper documentation. It
consists of various activities such as collecting, organizing, storing, and
maintaining all related program records.
• Testing: A flowchart helps in the testing process.
• Efficient program maintenance: The maintenance of the program becomes easy
with the help of a flowchart.
Disadvantages
• Time-consuming: Designing a flowchart is a
very time-consuming process.
• Complex: It isn't easy to draw a flowchart for
large and complex programs.
• There is no standard in the flowchart; there is
no standard to determine the quantity of
detail.
• Difficult to modify: It is very difficult to modify
the existing flowchart.
Adding Two numbers
largest among three numbers
Decision Table
• http://bcastuff.blogspot.com/2013/02/
decision-table.html#.Y5Rm73ZBzrc
pseudocode
• The pseudocode in C is an informal way of writing
a program for better human understanding. It is
written in simple English, making the complex
program easier to understand.
• Pseudocode cannot be compiled or interpreted. It
doesn't follow the programming language's
syntax; it is thus written in pseudocode so that
any programmers or non-programmers can easily
understand it.
Example
Int n = 10
for( i=0;i<n;i++)
printf(n);
• The above source code is converted into a
pseudo-code to understand in a better way.
 The value ten is assigned to the variable n.
 For value = zero to less than a number.
 Display the numbers.
Algorithm
• IN C programming language algorithms, we follow a step-by-step
procedure to solve a problem. You have the algorithm to execute a
set of instructions in a particular order to get an output.
• Algorithm for the Program Factorial of a Given Number.
 Step 1: start
 Step 2: initialize fact = 1
 Step 3: input from the user value n
 Step 4: for i=1 to i <= n repeat the process
 Step 5: fact = fact * i
 Step 6: i++ [increament i by one]
 Step 7: print fact value
 Step 8: stop
• Thanks

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy