You are on page 1of 26

CSE1008

Programming in C
Introduction to Computer

CSE1008: Dr. A.Viswanathan 1


Module:1 General Problem Solving Concepts
 Algorithm and Flowchart for problem solving
 with Sequential Logic Structure,
 Decisions and Loops.
 Imperative languages:
 Introduction to imperative language;
 syntax and constructs of a specific language (ANSI C).

CSE1008: Dr. A.Viswanathan 2


Input Process Output Model

Input Process Output

CSE1008: Dr. A.Viswanathan 3


Input Process Output Model

CSE1008: Dr. A.Viswanathan 4


Parts of a Computer

CSE1008: Dr. A.Viswanathan 5


What is computer?
• A computer is a programmable electronic device that takes
data, perform instructed arithmetic and logical operations,
and gives the output
• Whatever is given to the computer as input is called 'data',
while the output received after processing is called
'information'

CSE1008: Dr. A.Viswanathan 6


Introduction to Problem
solving

CSE1008: Dr. A.Viswanathan 7


• What is problem Solving?
The process of finding solutions to complex or difficult
issues.

CSE1008: Dr. A.Viswanathan 8


Problem solving steps:

Test /
Define Analysing Developing Coding /
review
the the an Program
the
Problem problem algorithm ming
results

CSE1008: Dr. A.Viswanathan 9


Algorithm
• A set of exact steps which when followed, solve
the problem or accomplish the required task.
• Writing an algorithm is the first step in
programming.
• It gives a roadmap of the program to be written.
• It helps to clearly visualize the program to be
written. So that the program can be free from errors.

CSE1008: Dr. A.Viswanathan 10


Three important steps in writing algorithm,
• The input to be taken from the user
• Processing or computation to be performed to get
the desired result
• The output desired by the user

CSE1008: Dr. A.Viswanathan 11


Algorithm for Sum of Two Numbers
 STEP 1: Start the program.
 STEP 2: Read the values of ‘a’&’b’.
 STEP 3: Compute the sum of ‘a’,’b’, store it to C=a+b.
 STEP 4: Print the value of ‘C’.
 STEP 5: Stop the program

CSE1008: Dr. A.Viswanathan 12


Flowchart
• A flowchart is a visual representation of an
algorithm.
• A flowchart is a diagram made up of boxes,
diamonds and other shapes, connected by arrows.
• Each shape represents a step of the solution
process and the arrow represents the order or link
among the steps

CSE1008: Dr. A.Viswanathan 13


Flowchart Symbols

CSE1008: Dr. A.Viswanathan 14


Flowchart for sum of two numbers
Start

Input num1,
num2

sum=num1+num2

Output or Print
sum

Stop

CSE1008: Dr. A.Viswanathan 15


Programming: For Single Task

Single Pot
Single Task
CSE1008: Dr. A.Viswanathan 16
Programming: For Multiple Task

Multiple Pot Multiple Task


CSE1008: Dr. A.Viswanathan 17
Programming: For Multiple Task

Multiple Pot Single Task


CSE1008: Dr. A.Viswanathan 18
Programming: For Multiple Task
Sum of 5 natural numbers
* For 5
* 1+2+3+4+5

Sum of 8 natural numbers


* For 8
* 1+2+3+4+5+6+7+8
CSE1008: Dr. A.Viswanathan 19
Programming: For Multiple Task
Sum of N natural numbers
• For N
• N(N+1)/2
➢ For 5
➢ 5(5+1)/2
• For 8
• 8(9+1)/2
CSE1008: Dr. A.Viswanathan 20
What is Programming?
• A set of instructions for a computer to perform some
task
• Computer is a computational device that is used to
process the data under the control of a computer
program. While executing the program, raw data is
processed into the desired output format.
• These computer programs are written in a
programming language which are high-level
languages

CSE1008: Dr. A.Viswanathan 21


• High level languages are nearly human languages
• The computer understandable language which
are called machine language, or low level
language.

CSE1008: Dr. A.Viswanathan 22


Some programming Languages
• Python • C#
• C/CPP • Ruby
• Java • Objective – C
• JavaScript • SQL
• PHP
• Swift

CSE1008: Dr. A.Viswanathan 23


• Front-end web development – JavaScript

• Back-end web development – JavaScript,


Python, Java, PHP, Ruby, C#

• Desktop application – Java, C++, Python

• Mobile development – Swift, Java, C#

• Game development – C++, C#


CSE1008: Dr. A.Viswanathan 24
Some Review Questions:
• What is a computer?
• List the types of computers.
• What is the most popular use for home computers?
• How are computer technologies used for various
applications?
• How are computer technologies used in Mechanical
Engineering?
• Name the major components of a computer?

CSE1008: Dr. A.Viswanathan 25


Sequential Logic Structure
• What is a computer

CSE1008: Dr. A.Viswanathan 26

You might also like