Computer programming

 Computer Programming & Programming Methodology

Unit-1 Introduction

A computer cannot perform any task of its own and can only understand its own

language which is the language of 0’s and 1’s that means binary number

system, therefore a computer user has to communicate with a computer using

the language which they can understand.

The set of instructions to perform a task in the computer that is known as a

program and the computer languages in which programs are written is known

as programming language. The person developing or writing programs is

known as “programmer”.

A computer cannot understand the natural language like English.

Examples of programming languages are C, C++, C#, Perl, Java, etc.

Introduction to C Programming

History of C Programming

 C is a programming language which was developed at “AT & T’s Bell 

Laboratory” of USA in 1972.

 C was written by Dennis Ritchie, that‟s why he is also called as father of 

C Programming language.

 C was created for specific purpose that is designing the UNIX Operating 

system.

Flowchart and Algorithm

 Algorithm and flowchart are two types of tools to explain the process 

of a program.

Algorithm:

A step by step method to solve the problem is called algorithm,

in other words, an algorithm is a procedure for solving

problems.

o Algorithm is a blueprint or plan of our program.

o Features of algorithm:

 Proper understanding of the program.

 Use of procedures and functions to emphasize

modules.

 Choice of variable names.

 Documentation of program.

Example:

Write an algorithm to display the sum of two numbers.

Step-1 Start

Step-2 Read two numbers a and b variable.

Step-3 Calculate the sum of a and b and store it in sum

variable.

Step-4 Display the value of sum variable.

Step-5 Stop

Advantages:

 It is step-wise representation of a solution to a given

problem, which makes it easy to understand.

 It is not dependent on any programming language, so easy

to understand for anyone even without programming

knowledge.

By using algorithm the problem is broken down into

smaller pieces or steps so it is easier for programmer to

convert it into an actual program.

Disadvantages:

 Writing algorithm takes a long time.

 An algorithm is not a computer program, it is rather a

concept of how a program should be.

Example:

#include<stdio.h>

#include<conio.h>

void main()

{

 printf(“ Hello World ”);

 getch();

 }

Practical: (how to do 1st program in C)

1) Open turbo C, by double click in icon.

2) Go to File menu and select New. Blue screen will be display.

3) Include #include<stdio.h> and #include<conio.h> header file.

4) Write void main()

5) Write your program within main().

6) Save your program by click on File menu and select save option or

Press F2 key to save your program.

7) Compile your program by click on Compile menu and select

compile option OR press Alt + F9. (If error occurs then solve

errors at compile time)

8) Run your program by click on Run menu and select Run option OR press Ctrl + F9.

Flowchart:

A flowchart is the graphical or pictorial representation of a

problem or program or algorithm with the help of different symbols,

shapes and arrows in order to demonstrate a process or a program.

The main purpose of a flowchart is to analyze different processes.

Comments

Popular posts from this blog

Functional units of computer

Applicant for computer

Third generation of computer