Computer Programming

Before we move towards C language. First we have to know what is Computer programming. And what are some important things which we must know to create any program or any coding for any software or a game.
Computers do “what we tell them to do”, NOT “what we want them to do”.

Computer Programming involves writing instructions and giving them to the computer to complete a task.

An Algorithm is sequence of steps, by which a computer can produce the required outputs from the available inputs. “An effective procedure for solving a class of problems in a finite number of steps.”

Pseudo code is an artificial and informal language that helps programmers develop algorithms.               Pseudo code is very similar to everyday English.

A Flowchart is a visual representation of an algorithm. A Flowchart uses easy-to-understand symbols to represent actions on data and the flow of data. Flowcharts aid in breaking down a problem into simple steps.

Algorithm & Pseudo code  [  Example 1  ]

Write an algorithm to determine a student’s final grade and indicate whether it is passing or failing. The final grade is calculated as the average of four marks.

Pseudo code: 
Input a set of 4 marks 
Calculate their average by summing and dividing by 4
if average is below 50
Print “FAIL” 
else 
Print “PASS”

 Algorithm  
Step 1:   Input M1,M2,M3,M4
Step 2:  GRADE ← (M1+M2+M3+M4)/4 
Step 3:  if (GRADE < 50) then
Print “FAIL” 
else
Print “PASS” 
endif




Algorithm & Pseudo code  [  Example 2  ]
Write an algorithm and draw a flowchart that will read the two sides of a rectangle and calculate its area.
Pseudo code
Input the width (W) and Length (L) of a rectangle
Calculate the area (A) by multiplying L with W
Print A



Algorithm
Step 1:  Input W,L
Step 2:  A ← L  x  W
Step 3:  Print A









Computer Language

A computer language is a set of rules and conventions used to convey the information to a computer.

3 Types of Computer Languages

1. Machine Language

2. Low Level Language 

3. High Level Language


  • Machine Language The  native  tongue  of  a  computer  is  the  Machine. Language. Each Machine Language instruction is a binary  string  of  0’s  and  1’s  that  specifies  an operation and identifies the memory cells involved in that operation.

  • Low Level Language, Machine Language is still used by the computer as it processes data, but Low  Level  Language  software  first  translate  the specified  operation  symbol  onto  its  Machine Language equivalent. Example is Assembly Language.
 
  • High  Level  Language  is  a  programming  language where an instruction resembles everyday language. Instructions  are  given  to  a  computer  by  using  a convenient  letters,  symbols  or  English  text  rather than  by  using  1’s  and  0’s  code  that  the  computer understands. Example is Basic and Pascal etc. 
Difference between the High Level Language and the other two.
The  main  difference  between  the  High  Level Language  and  the  other  two  are  that  High  Level Language  is  much  easier  and  understandable  by  a human  being  and  the  second  difference  is  that  in High  Level  Language  one  instruction  can  perform several machine level instructions. 

Where C Language Stands.
 C Language in between the Low Level Language and High  Level  Language.  That’s  why  it  is  also  called  a Middle  Level  Language,  since  it  was  designed  to have  both:  a  relatively  good  programming  efficiency and relatively good machine efficiency.

Relation between High Level Language and Machine Language:
  •  Because  a  computer  understands  only  programs written  in  machine  language,  each  instruction  in  the High  Level  Language  programs  must  first  be translated into the machine language before it can be executed. 
  •  The original High Level Language written program is called  the  Source  Program;  and  the  machine language translation is called the Object Program.