You are on page 1of 4

FUNDAMENTALS OF C

st
UNIT I - FUNDAMENTALS OF C

IMPORTANT TOPICS:
 Types of programming
 Pseudocode
 Algorithm
 Flowchart
 Definition of Program
 Basic structure of C program
 Compiler vs Interpreter
 Programming Token
 Types of Tokens in C
 Data type
 Type Casting
 Decision making
 Input, Output, Function
 Comments in C

TYPES OF PROGRAMMING:
Not that imp for the test

PSEUDOCODE:
“It is a simpler version of a programming code in plain English which uses short phrases to write
code for a program before it is implemented in a specific programming language.”

Pseudocode is an artificial and informal language that helps programmer to develop programs.
Pseudocode is text-based detail design tool.
It is an intermediary between an algorithm and implemented program.

Ex: - Write a pseudocode to calculate simple interest.


1. Start the program.
2. Read Principal amount, rate of interest and time period.
3. Calculate interest by using the formula. Simple interest= (Principal amount x rate of interest x
time period)/100

Page 1 of 4
FUNDAMENTALS OF C

4. Print the simple interest.


5. Stop the program.

Pseudocode is used to make programs easy to understand for other programmers


There is no fixed way to writing pseudocode, you just describe you program in human lang.

Important Questions to keep in mind: -

1. What is pseudocode?
2. What’s the purpose of pseudocode?
3. What’s the difference between pseudocode and algorithm?
4. Write a pseudocode for swapping two values.
5. Write a pseudocode for given program.

ALGORITHM:
“Systematic logical approach which is a well-defined, step-by-step procedure that allows a
computer to solve a problem.”

A programming algorithm is a procedure or formula used for solving a problem.

It is based on conducting a sequence of specified actions in which these actions describe how to
do something, and your computer will do it exactly that way every time. An algorithm works by
following a procedure, made up of inputs.

The difference between algorithm and pseudocode:


Algorithm:
Systematic logical approach which is a well-defined, step-by-step procedure that
allows a computer to solve a problem.

Pseudocode:
It is a simpler version of a programming code in plain English which uses short
phrases to write code for a program before it is implemented in a specific programming language.

To understand it further let’s write the algorithm of the same program earlier.

Ex: - Write an algorithm to calculate simple interest.


Step 1: START

Step 2: Declare variables p, n, r and si.

Step 3: Read the values of variable p (principal), n (Number of years), r (Rate of Interest).

Step 4: calculate the values of “si = (p * n * r)/100 “.

Step 5: Display si (simple interest).

Step 6: STOP

Page 2 of 4
FUNDAMENTALS OF C

Here we go step by step in a systematic order and use more programming terms which shows the
exact procedure a computer go through to solve the given problem.

Important Questions to keep in mind: -


1. What is an Algorithm?
2. The purpose of Algorithm?
3. How do we write an Algorithm?
4. What’s the difference between algorithm and pseudocode?
5. Write an algorithm to calculate the average of three numbers.

FLOWCHART:

DEFINATION OF PROGRAM:

BASIC STRUCTURE OF C PROGRAM:

COMPILER VS INTERPRETER:

PROGRAMMING TOKEN:

TYPES OF TOKENS IN C:

DATA TYPE:

TYPE CASTING:

DECISION MAKING:

INPUT, OUTPUT, FUNCATION:

COMMENTS IN C:

Page 3 of 4
FUNDAMENTALS OF C

Page 4 of 4

You might also like