introduction to computing technologies-ict
TRANSCRIPT
-
7/27/2019 Introduction to Computing Technologies-ICT
1/30
Introduction to Computing Technologies-ICT
Trupti V.G
Name of Book: Fundamentals of computers.
Author: V.Rajaraman
Subject code: 13CT101
Credits: 4
-
7/27/2019 Introduction to Computing Technologies-ICT
2/30
Chapter 1
Learning Objectives:Idea of an algorithm
Parts of computer
Characteristics of computers
Purpose of computers
-
7/27/2019 Introduction to Computing Technologies-ICT
3/30
8.3
Informal definition
An informal definition of an algorithm is:
Algorithm: a step-by-step method for solving a
problem or doing a task.
Informal definition of an algorithm used in a computer
-
7/27/2019 Introduction to Computing Technologies-ICT
4/30
Preparing Maggi
Example
Ingredients:
water 2 cups, maggi noodles 1 pack.
Method: Step 1: Boil 2 cups of water
Step 2: Add maggi noodles to it
Step 3: Add maggi masala to the noodles
Step 4: Cook for 5 minutes till the noodles bake well
Result:
Maggi noodle ready to eat
-
7/27/2019 Introduction to Computing Technologies-ICT
5/30
Algorithm
-
7/27/2019 Introduction to Computing Technologies-ICT
6/30
8.6
Example: Finding the largest integer among five integers
-
7/27/2019 Introduction to Computing Technologies-ICT
7/30
Defining actions
Writing algorithm for the example
-
7/27/2019 Introduction to Computing Technologies-ICT
8/30
History of algorithm
Algorithm name came from Arab Mathematician Abu
Jafar Mohammed ibn Musa al-khowarizmi
al-khowarizmi was called algorithm.
-
7/27/2019 Introduction to Computing Technologies-ICT
9/30
Characteristics of algorithm
Finite sequence of instructions. Characteristics:
Begins with inputs, inputs are instructions.
Processing rules specified in the algorithm must beprecise and unambiguous.
Basic instructions that can be understood andcarried out.
Time taken to carry out all the steps in algorithmmust be finite.
It must produce one or more outputs.
-
7/27/2019 Introduction to Computing Technologies-ICT
10/30
Step 8: average no of vowels=number of vowels/ number of characters
Step 7: Move to next character
Step 6: if the character is any one of the letters A,E,I,O,U,a,e,I,o,u, add
1 to number of vowels
Step 5: add 1 to number of characters
Step 4: read one character from passage
Step 3: repeat steps 4,5,6,7 till end of paragraph
Step 2: let number of vowels=0
Step 1: let number of characters =0
Algorithm to find no of vowels in a paragraph
Step 9: write avg no of vowels, number of characters
Step 10: stop
-
7/27/2019 Introduction to Computing Technologies-ICT
11/30
Write an algorithm to convert the length in feet to centimeter.
Algorithm
Step 1: Input the length in feet
Step 2: Calculate the length in cm by multiplying LFT
with 30Step 3: Print length in cm
-
7/27/2019 Introduction to Computing Technologies-ICT
12/30
What is a computer?
An electronic machine that can be programmed to
accept data (input), and process it into useful
information (output).
Computers are devices powered by electricity, whichhas two discrete states: On orOff.
-
7/27/2019 Introduction to Computing Technologies-ICT
13/30
-
7/27/2019 Introduction to Computing Technologies-ICT
14/30
A simple model of a computer
14
Input unit Memory Output
Processing unit
-
7/27/2019 Introduction to Computing Technologies-ICT
15/30
Configuration
Input unit: Read the algorithm and data to be processed.
Memory unit:
Stores the algorithm and computes the values.
Processing unit: Interprets the instruction and carries arithmetic operations,
character manipulation operations and logical operations.
Output unit:
Prints or displays result.
-
7/27/2019 Introduction to Computing Technologies-ICT
16/30
Characteristics of a computer
Processes various instructions. Simple instructions
High speed
Precise
No mistakes
-
7/27/2019 Introduction to Computing Technologies-ICT
17/30
Problem solving using computers
Steps:
Given problem is analyzed.
Methods broken into sequence of tasks.
Algorithm is expressed in a precise notation
(computer programming language)
Computer program is fed into the computer
Processing is done and results are sent to output unit
-
7/27/2019 Introduction to Computing Technologies-ICT
18/30
Flowchart
Definition: Pictorial representation of an algorithm.
shows logic of an algorithm
emphasizes individual steps and their
interconnections
Ex: find the total marks and calculate grade.
-
7/27/2019 Introduction to Computing Technologies-ICT
19/30
19
Rectangles with
rounded ends
Start / stop
Parallelograms
Input / output
Rectangles
to show
Processing
steps
Diamond shape box
For Decision making
Flow of control
-
7/27/2019 Introduction to Computing Technologies-ICT
20/30
START
Input
M1,M2,M3,M4
GRADE(M1+M2+M3+M4)/4
IS
GRADE
-
7/27/2019 Introduction to Computing Technologies-ICT
21/30
START
Input
Length in feet
Length in cm Lft x 30
Print
Length in cm
STOP
Draw a flowchart to convert the length in feet to centimeter.
-
7/27/2019 Introduction to Computing Technologies-ICT
22/30
Programming Language: expressing flowchart in amore precise and concise notation.
Examples: Java programming language, c, FORTRANClass a
{public static void main(String[] args)// an example of java
program
{ int m1=10, m2=20, m3=40, m4=35;
int avg;
avg=(m1+m2+m3+m4)/4;
System.out.println(avg);
} }
A Program
-
7/27/2019 Introduction to Computing Technologies-ICT
23/30
Stored program concept
Model of a computer: Proposed by John Von
Neumann in 1945.
Concept: Storing a program and processing the data
in the same memory Use: Repetitive execution of series of instructions.
Storing a program in memory makes the operations
automatic without human intervention.
-
7/27/2019 Introduction to Computing Technologies-ICT
24/30
Write an algorithm and draw a flowchart that will read the two
sides of a rectangle and calculate its area
Algorithm
Step 1: Input W,L
Step 2: A L x W
Step 3: Print A
Pseudocode
Input the width (W) and Length (L) of a
rectangle
Calculate the area (A) by multiplying Lwith W
Print A
START
Input
W, L
A L x W
Print
A
STOP
-
7/27/2019 Introduction to Computing Technologies-ICT
25/30
Write an algorithm and draw a flowchart that will calculate the roots
of a quadratic equation ax2+bx+c=0
Hint: d = sqrt ( ), and the roots are:x
1 = (
b + d)/2a andx2 = (b d)/2a
24b ac
Algorithm:
Step 1: Input a, b, cStep 2: d sqrt ( )
Step 3: x1 (b + d) / (2 x a)
Step 4: x2 (b d) / (2 x a)
Step 5: Printx1,x2
START
Input
a, b, c
d sqrt(b x b 4 x a x c)
Print
x1 ,x2
STOP
x1(b + d) / (2 x a)
X2 (b d) / (2 x a)
4b b a c
-
7/27/2019 Introduction to Computing Technologies-ICT
26/30
General Concept
How does one figure out the percentage of several
marks?
Add them all up
Divide by the maximum possible mark (50+20+70)
Multiply by 100
Given 3 assignment marks (out of 50, 20, 70), find the average(calculated as a mark out of 100)
-
7/27/2019 Introduction to Computing Technologies-ICT
27/30
Given 3 assignment marks (out of 50, 20, 70), find theaverage, calculated as a mark out of 100
Algorithm:Set MaxMark = 140 (Constant)
Step 1: Get A1
Step 2: Get A2
Step 3: Get A3
Step 4 Let Total = A1 + A2 + A3
Step 5: Let Mark = Total/MaxMark * 100
Step 6: display result
-
7/27/2019 Introduction to Computing Technologies-ICT
28/30
Given a two digit number, find the
sum of its digits
General Concept
How can we break apart a number?
41 = 4 Tens and 1 Ones
so for the number 41, we want 4 + 1 = 5
Use integer division
DIV returns the integer part of a
division
MOD returns the remainder of adivision
41 / 10 = 4
41 MOD 10 = 1
-
7/27/2019 Introduction to Computing Technologies-ICT
29/30
Given a two digit number, find the sum of its digits
ALGORITHM:
Step 1: Get N
Step 2: Let Tens = N div 10
Step 3: Let Ones = N mod 10
Step 4: Let Sum = Tens + Ones
Step 5: Display Sum
-
7/27/2019 Introduction to Computing Technologies-ICT
30/30
Exercise problems
Write an algorithm and flowchart to add two numbers
and check if the resulting number is even or odd.
Write an algorithm to find the direction or path from
PESIT to chinnaswamy stadium.