You are on page 1of 6

M1.

1: INTRODUCTION:
C-language is a high-level programming language. Now what is the mean of

high level and what is a programming language?


A language is a system of communication. With our natural language such
as English, we communicate to one another our ideas and emotions. Similarly,
a computer language is a means of communication used to communicate
between people and the computer. With the help of a computer language, a
programmer tells a computer what he wants it to do. At the very simplest level
it means issuing a sequence of instructions to a computer to achieve an
objective. As C is a programming language; it is used to issue a set of
instructions (program) to computer to do the given task.
Now to understand what we means by high-level language; we have to
discuss the classification of programming language.

M1.2: COMPUTER LANGUAGES:


Mainly we can classify computer languages in two categories: Low level and high
level languages. In the low-level languages; there comes again a classification in
Machine language and Assembly language. This is shown in following figure:

(Classification of Computer Languages)


Page 1

www.magix.in

M1.2.1: Low Level Languages:


The languages which use only primitive operations (basic operations like add,
subtract etc) of the computer are known as low language. For each type of
computer there is a separate low level programming language i.e. low level
programming language differ from computer to computer. In the other words,
Programs written in one low level language of one architectural cant be ported on
any other machine with differ architecture. Examples are Machine Language and
Assembly Language.
MACHINE LANGUAGE:
Machine language is normally written as strings of binary 1s and 0s, to which
the computer responds directly. As it is a low level language; it is machine
dependent. But its greatest advantage is that is faster in execution since the
computer directly starts executing it.
The program to add two numbers in memory and print the result might look
something like the following:
001000000001100111001
001000110110000011010
011001100000001000100
101000010111000010000
000000000000000000000
ASSEMBLY LANGUAGE:
These languages substitutes alphabetic or numeric symbols for the binary
codes of machine language. For example, a computer may be designed to
interpret the machine code of 1111(binary) as the operation subtract. As this is
also a low level language; it is machine dependent.
These languages require a translator known as Assembler for translating
the program code written in assembly language to machine language. Because
computer can interpret only the machine code instruction, once the translation is
completed the program can be executed.
The program to add two numbers in memory and print the result might look
something like the following:
CLA A
ADD B
STA C
TYP C
HLT
The low language program got one advantage as they are executed fast by the
computer as the computer can understand them directly. But these programs are
difficult to read and understand by humans and are also machine dependent.
Page 2

www.magix.in

M1.2.2: High Level Languages:


In high-level languages, programs are written in statements akin to English
language. These languages require translators (compilers and interpreters) for
execution. The programs written in a high level language can be ported on any
computer; that is why they are known as machine independent.
These languages enable the programmer to write instruction using English
words and familiar mathematical symbols which makes it easier than technical
details of the computer. It makes the programs more readable too.

(Fig M1.1: Relation between Computer hardware and programming languages)

M1.3: PROBLEM SOLVING TECHNIQUES:


As we know now that C is a programming language; and it is used to develop
programs to solve a problem. Now before getting into how to develop programs to
solve a problem; we will first discuss, how to first design logic to solve the problem
(and also to code the program).
A problem-solving tool is a set of techniques and graphical tools that helps in
providing the logic for solving a problem. In other words, these tools are used to
express the logic of the problem by specifying the correct sequence of all instruction
to be carried out. The following section discusses the various problem-solving tools:
algorithms and flow charts.

M1.3.1: ALGORITHMS:
An algorithm is the step-by-step solution to a certain problem. Algorithms can
be expressed in any language, from natural languages like English or French to
programming languages like FORTRAN.
We use algorithms every day. For example, a recipe for baking a cake is an
algorithm. In another example a plan of how you will play a game is simple
algorithm.
Page 3

www.magix.in

Simple Example of algorithm:


One of the simplest algorithms is to exchange values of two variables.
Algorithm ExchangeValues:
Let a and b be two integer variables. This algorithm will exchange values of these
two variables.
Step 1
Step 2
Step 3
Step 4
Step 5
Step 6
Step 7

:
:
:
:
:
:
:

Begin
Read the values A and B
Store the values of A into temp //here temp is a variable
Store the value of B into A
Store the value of temp into B
Print the values of A and B
END.

Another Example:
Write an algorithm to calculate the sum of n numbers.

Algorithm SumOfNumbers:
This algorithm will calculate the sum of n numbers.
Step 1
Step 2
Step 3
Step 4
Step 5
Step 6
Step 7
Step 8
Step 9

:
:
:
:
:
:
:
:
:

Begin
Read the value of total numbers to be summed into n
Set sum=0
Repeat step 5 to step 7 while n>0
Read a value of x
Add the value of x with the value of sum and store the result in sum

Decrement the value of n


Print the value of sum
END

M1.3.2: FLOWCHARTS:
A flowchart is a pictorial representation of an algorithm,
indicating the flow of the data and the operations performed on
data. It provides the visual representation of an algorithm by
representing each and every step of an algorithm with the help of
different symbols. There are many symbols for representing
flowcharts. But at this stage, we will discuss only basic symbols of
drawing a flowchart, which are as follows:

Page 4

www.magix.in

(Basic symbols and their meaning while drawing a flowchart)


These points should be considered while using symbols in a flowchart:
1. Each symbol denotes a different type of operation and contains some
instructions.
2. These symbols are connected to each other to indicate the flow of information
and processing.

Page 5

www.magix.in

Simple Example of Flowchart:


At first we will draw the flowchart for simple algorithm for finding out
maximum number from given three numbers.

(Flowchart for finding out the largest of three numbers)


Example2 of Flowchart:

Draw a flowchart to find the sum of first 50 natural numbers.

Page 6

www.magix.in

You might also like