Introduction To Computers

Slides:



Advertisements
Similar presentations
1 Chapter 2 BASIC CONCEPTS of Computer science OBJECTIVES define a computer identify characteristics of computer know the origin and evolution.
Advertisements

CSCI 1412 Tutorial 1 Introduction to Hardware, Software Parminder Kang Home:
Chapter 1 - An Introduction to Computers and Problem Solving
ITEC113 Algorithms and Programming Techniques
Chapter 1 An Overview of Personal Computers
1 The development of modern computer systems Early electronic computers Mainframes Time sharing Microcomputers Networked computing.
History of computers By Anne Perera.
Information Technology Ms. Abeer Helwa. Computer Generations First Generation (Vacuum Tubes) -They relied on the machine language to perform operations.
 What’s a Computer? What’s a Computer?  Characteristics of a Computer Characteristics of a Computer  Evolution of Computers Evolution of Computers.
INTRODUCTION TO COMPUTING
Introduction to computer Submitted by : aashish.c ashish.m Abhijeet.g Ankit.j abhay.j SEC:A PGDM SEM I: MAISM.
Classification of Computers
UniMAP Sem1-08/09EKT120: Computer Programming1 Week 1 – Lecture 1.
An overview of Computer System
GE6151 COMPUTER PROGRAMMING.
Advanced Computer Architecture 0 Lecture # 1 Introduction by Husnain Sherazi.
6/4/ Key components of the computer Classification of computers based on Purposes Classification of computers based on Signals Classification of.
Computer Hardware Basic Computer Concepts Components of Data Processing  Data processing is a technique of collecting, manipulating and distributing.
PROGRAM DEVELOPMENT CYCLE. Problem Statement: Problem Statement help diagnose the situation so that your focus is on the problem, helpful tools at this.
Classification of Computer
Computer Organization & Architecture
UniMAP Sem2-10/11 DKT121: Fundamental of Computer Programming1 Introduction to C – Part 1.
Program Program is a collection of instructions that will perform some task.
Computer A Computer may be defined as an electronic device that operates upon data. So, a computer can store, process and retrieve data as and when desired.
1 Chapter 1 Basic Structures Of Computers. Computer : Introduction A computer is an electronic machine,devised for performing calculations and controlling.
Lecture 1 (Introduction)
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
Generations of Computer First generation of computer The beginning of commercial computer age is from UNIVAC (Universal Automatic Computer). Scientists.
نظام المحاضرات الالكترونينظام المحاضرات الالكتروني Introduction :: Computer Organization and Architecture Computer.
Chapter 1 Introduction.
4. History of Computing Technology
Computer Science Introduction
Computer Architecture and Number Systems
ALGORITHMS AND FLOWCHARTS
Computer Generations First Generation ( )
Introduction to Computer
Computer Organization and Architecture
Introduction to Microprocessors
What is a computer? Simply put, a computer is a sophisticated electronic calculating machine that: Accepts input information, Processes the information.
6. Structure of Computers
Week 1 – Session 1 Pn. Yasmin Yacob 04 – KUKUM Sem2-06/07
COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE
Concepts of CS Lecture 1.
What is a computer? Simply put, a computer is a sophisticated electronic calculating machine that: Accepts input information, Processes the information.
Algorithms and Flowcharts
Computer Architecture
Lecture 2 Introduction to Programming
Course Name: Computer Application Topic: Central Processing Unit (CPU)
Introduction to Microprocessors
Algorithm Algorithm is a step-by-step procedure or formula or set of instruction for solving a problem Its written in English language or natural language.
Generations of Computers
Information Technology
Course Outline Computer: Introduction Characteristics
PROBLEM SOLVING AND OFFICE AUTOMATION
The Five Generations of Computers
Introduction to IT Zeeshan A. Bhatti.
Unit# 9: Computer Program Development
BIC 10503: COMPUTER ARCHITECTURE
Microprocessor & Assembly Language
Basic Computer Organization
Introduction To Computers
Introduction to Algorithms and Programming
Classification of computers
Overview of Computer Architecture and Organization
Fundamental of computer
Introduction to Computer Programming
Introduction to Computer Architecture
The Five Generations of Computers
Basic Concepts of Algorithm
Computer Generations.
Presentation transcript:

Introduction To Computers UNIT-I Introduction To Computers

Introduction to Computer Early days people use fingers for computing purpose. As years go, the computing needs also grew. This leads to the invention of calculators and computers. The term computer is derived from the word compute, it means to calculate.

Definition Computer is an electronic device. It accepts data, process the data and gives the desired output. COMPUTER INPUT OUTPUT

Basic functions or operations Input Processing Output Storing Controlling

Basic operations (Cont) Input It is the process of getting the data from the user or from somewhere else into the computer to process. Processing It is the process of converting the input to output.

Basic operations (Cont) Output It is the outcome or result of the process. Storing It is the process of saving the data. so that it can be retrieved whenever needed.

Basic operations (Cont) Controlling It is the process of directing the sequence in which the operations to be performed.

Applications of computer: Business Industry Home Education Printing & publishing Entertainment etc.,

BASIC ORGANIZATION OF COMPUTER It involves interfacing different units of computer and various operations between these units It explains the way in which different units of computers are controlled and interconnected with each other Basic Units of Computer Organization Input Unit Memory Unit Central Processing Unit Output Unit

I/P UNIT MEMORY UNIT O/P UNIT CACHE MEMORY REGISTERS ALU CONTROL UNIT Basic organisation of computer I/P UNIT MEMORY UNIT O/P UNIT CACHE MEMORY REGISTERS ALU CONTROL UNIT Block Diagram of a Computer System

Basic organisation of computer INPUT UNIT The input unit is used to feed information or instruction to the computer. Input Devices: Keyboard Mouse Scanner…

Basic organisation of computer (cont) MEMORY UNIT Used to store Data Instructions Intermediate Results & Final Processed Results Types Primary Secondary Internal Processor memory Primary memory is used to store temporary data. Ex:RAM, ROM etc,. Secondary memory is used to store information permanently Ex:Hard disk. Internal Processor memory is used to store temporary processor data Ex:CPU Registers

Basic organisation of computer (cont) CENTRAL PROCESSING UNIT (CPU) Responsible for processing the data & instruction and controlling all other components Operation (4 Phases) Fetching Instruction from the memory Decoding the instruction Executing the instructions Storing the results in to the memory It contains the following components CONTROL UNIT ALU MEMORY

Basic organisation of computer (cont) CONTROL UNIT It controls all other units in the computer. It directs the sequence in which operations to be performed. It also controls the flow of data between various units.

Basic organisation of computer (cont) ARITHMETIC & LOGICAL UNIT It performs all arithmetic & logical operations. i.e. arithmetic operations like addition, subtraction, multiplication, division etc,. And logical operations like AND,OR,NOT etc,.

Basic organisation of computer (cont) Registers CPU contains a few special purpose, temporary storage units called registers They are high speed memory locations Used for handling instructions, data & intermediate results that are currently being processed Program Counter(PC) Instruction Register(IR) Memory Address Register(MAR) Accumulator

Basic organisation of computer OUTPUT UNIT The output unit is used to display the result of the process. Data processed by CPU is made available to the end user by O/P devices Commonly used O/P devices: Monitor Printer Speaker

Classification of Computer

Classification of Computer Based on Operating Principles Based on Applications Based on Size & Capabilities Analog Computers Digital Computers Hybrid Computers Micro Computers Mini Computers Mainframe Computers Super Computers Special Purpose Computers General Purpose Computers

Based on Operating Principles Analog Computers It represent data in the form of continuous electronic signals. Very fast in their operations and allows several processes carried out at the same time. The results are not accurate, therefore widely used in applications in which accuracy of result is not a major concern. It is a powerful tool to solve the differential equations.

Based on Operating Principles Digital Computers It stores and process data in digital form It is capable of processing analog data. Faster and more reliable than analog computers Provides more accurate results. Digital computers are employed in home, colleges, universities, business…..

Based on Operating Principles Hybrid Computers Combination of analog and digital computers. Hardware components are mixture of analog & digital computers. These features make hybrid computers very fast, efficient and reliable. Applications includes hospitals, scientific applications, engineering….

Based on application computers are classified as Based on Applications Based on application computers are classified as General Purpose Computers: It works in all environment It is versatile and stores number of programs It is not efficient and consumes large amount of time in generating the results.

Special Purpose Computers: Based on Applications Special Purpose Computers: It can perform only specific task. It is not versatile Speed and memory depends on task that is to be performed. Less expensive Efficient and consumes less amount of time in generating results.

Based on size and capability Microcomputer Microcomputer is at the lowest end of the computer range in terms of speed and storage capacity. Eg: Desktop, Laptop, Tablet PC, Smart Phones.

Based on size and capability Mini Computer This is designed to support more than one user at a time. (up to 200 users) It possesses large storage capacity and operates at a higher speed. This type of computer is generally used for processing large volume of data in an organisation. Eg:Servers in Local Area Networks (LAN).

Based on size and capability Mainframes They operate at very high speed, having very large storage capacity and can handle the work load of many users(more than 200 users. They are generally used in centralised databases.

Based on size and capability Supercomputer They are the fastest and most expensive machines. They have high processing speed compared to other computers. They have also multiprocessing technique. Supercomputers are mainly being used for whether forecasting, biomedical research, and other areas of science and technology

Generations of Computers

Generations of Computers (Cont) First Generation Computers(1940-1956): These computers were vacuum tube based machines. They used magnetic drums for memory. Input were fed into the computer using Punched cards The size of these computers were very large and it produce more heat. They lacked in versatility and speed. They were more expensive.

First Generation Computers(1940-1956): Speed: Fastest computing device of its time Technology: Vacuum Tubes : Made up of glass contains filaments, when heated generates electrons which helps in amplification and de amplification of signals I/p & O/p : Punched card and print out Programming language: Machine level language Example: EDSAC: Electronic delay storage automatic calculator EDVAC: Electronic discrete variable automatic computer

First Generation Computers(1940-1956): Advantages: Fastest computing device of their time Execute complex mathematical problems in an efficient manner Disadvantages: Large & Bulky Difficult to program Cannot be transferred from one place to another These are special purpose computers Generates huge amount of heat and hence prone to hardware faults

Generations of Computers (Cont) Second Generation Computers (1956-1963) Here the Transistor replaced the bulky vacuum tubes. Transistors are smaller than vacuum tubes and have higher operating speed. Thus the size of the computer got reduced considerably. Manufacturing cost was also very low.

Second Generation Computers (1956-1963): Speed: Faster than first generation Technology: Transistor : Used to increase the power of incoming signals. It has 3 connections: Base : Through which incoming signals are sent Collector : Collects amplified signal Emitter : Emits amplified signal I/p & O/p : Punched card and print out Programming language: Assembly language Example: IBM 1401 IBM 1620

Second Generation Computers (1956-1963): Advantages: Fastest computing device of their time Easy to program Light weight Low power consumption Low maintenance Transferred from one place to another easily Disadvantages: High cost Limited to special purpose tasks Generates considerable amount of heat

Generations of Computers (Cont) Third Generation Computers (1964-1975) These computers were based on Integrated Circuits (ICs) Technology. A single IC has many transistors, registers and capacitors built on a single thin slice of silicon. So that the size of the computer got further reduced. These Computers were small in size, low cost, large memory and processing speed is very high.

Third Generation Computers (1964-1975): Speed: Fastest computing device of its time Technology: Integrated Circuits : Also known as micro electronics technology Programming language: High level language Example: IBM 360 Honeywell 6000

Third Generation Computers (1964-1975): Advantages: Computational time was measured in nano seconds Requires low power to operate Small size Installation is very easy Able to execute any type of applications More reliable & requires less maintenance Easily transportable Disadvantages: Storage capacity was very small Performance will get degrade while executing large applications Cost is very high Required to be placed in air conditioned plates

Generations of Computers (Cont) Fourth Generation Computers(1975-1989) It uses very large scale Integrated Circuits (VLSI) built on a single silicon chip called microprocessors . These computers are called microcomputers. Thus the size of the computer got reduced. The personal computer (PC) are comes under the Fourth Generation.

Fourth Generation Computers (1975-1989): Speed: Fastest computing device of its time Technology: VLSI : Very large scale Integration It leads to the development of GUI, Operating Systems, Various storage devices, I/O devices and LAN It has 3 components: Microprocessors Memory I/O Controls Programming language: High level language Example: IBM PC series Apple Series

Fourth Generation Computers (1975-1989): Advantages: Very powerful in terms of speed & time Storage capacity is very high & it is very fast Highly reliable and requires low maintenance Provides user friendly environment using GUI(Graphical user interface) Programs are highly portable Highly versatile and requires less power Disadvantages: The soldering of VLSI chips on the wiring board was not an easy task Working of these computers depends on instructions given by the programmer

Generations of Computers (Cont) Fifth Generation Computer(1989-Till date) The speed is extremely high in fifth generation computer. The concept of Artificial intelligence has been introduced to allow the computer to take its own decision. It is still in a developmental stage .

Fifth Generation Computers (1989-Till date): Speed: Faster of all times Technology: ULSI : Ultra large scale Integration It has more than10 million electronic components It increases the power & speed of the microprocessor Programming language: High level language Integrated development environment Example: Laptop PDA

Fifth Generation Computers (1989-Till date) Advantages: Fastest & powerful computers till date Able to execute a large no of application at very high speed. ULSI Technology helps in decreasing the size of computers. Multimedia features are available Resource sharing is possible & is highly versatile Disadvantages: Lack of human like Intelligence

NUMBER SYSTEM

NUMBER SYSTEM Number System A computer is a digital system that stores and process data in the form of 0’s and 1’s(Binary/Machine language) Hence there is a need to change the data in the form of 0’s &1’s Positional Number System Numbers are represented using some symbols called digits and the values of these no’s can be determined by taking the position of digits Catagories: Decimal System Binary System Hexa Decimal System Octal System

NUMBER SYSTEM …. Decimal System Uses 10 as a base & is called base 10 no system 10 symbols are available for representing values (0-9) Used to represent both integer & floating point values Representation 6543.12410 (6x10^3)+(5x10^2)+(4x10^1)+(3x10^0)+(1x10^-1)+(2x10^-2)+(4x10^-3) = 6543.12410

NUMBER SYSTEM …. Binary System Uses 2 as a base & is called base 2 no system 2 symbols are available for representing values (0 & 1) Representation 101001.01012 (1x2^5)+(0x2^4)+(1x2^3)+(0x2^2)+(0x2^1)+(1x2^0)+(0x2^-1)+(1x2^-2)+(0x2^-3)+(1x2^-4) = 41.312510

NUMBER SYSTEM …. Hexa Decimal System Uses 16 as a base & is called base 16 no system 16 symbols are available for representing values (0-9 & letters A,B,C,D,E,F) Representation 4A9.2B16 (4x16^2)+(10x16^1)+(9x16^0)+(2x16^-1)+(11x16^-2) = 1193.167910

NUMBER SYSTEM …. Octal System Uses 8 as a base & is called base 8 no system 8 symbols are available for representing values (0-7) Representation 215.438 (2x8^2)+(1x8^1)+(5x8^0)+(4x8^-1)+(3x8^-2) = 141.546910

NUMBER SYSTEM …. DECIMAL BINARY OCTAL HEXA DECI.. 1 2 10 3 11 4 100 5 101 6 110 7 111 8 1000 9 1001 1010 12 A 1011 13 B 1100 14 C 1101 15 D 1110 16 E 1111 17 F 10000 20

Number System Number Base B => B symbols Base 16(Hexa):0, 1,……9, A ,…, E, F Base 10 (Decimal): 0, 1, 2,……, 7, 8, 9 Base 8(Octal): 0, 1, 2, 3, 4, 5, 6, 7 Base 2 (Binary): 0, 1

Problem Solving Steps Analyse the problem. Identify the solution for the problem and divide it into small task. Algorithm has to be prepared. Based on the algorithm the program will be created. Then it has to be executed. Noornilo Nafees

Algorithm An algorithm is a well organized, pre arranged and defined textual computational module that receives some values or set of values as IP & provides a single or a set of values as OP. It helps the programmer in breaking down the solution of a problem into a number of sequential steps. Noornilo Nafees

Characteristics The steps in the algorithm must be unambiguous . It should be written in sequence. Ensure that the algorithm will terminate. It should conclude after a finite number of steps. Noornilo Nafees

Factors used to judge the algorithm Time Memory Accuracy Sequence etc,. Noornilo Nafees

Example Addition of two numbers Step1: Start Step2: Read a, b Step3: Add the value of a with b and store the result in c. Step4: Display the value of c Step5: Stop Noornilo Nafees

Pseudocode Pseudo means imitates and code means instruction. It is formal design tool. It is also called Program Design Language. Noornilo Nafees

Keywords READ,GET PRINT,DISPLAY COMPUTE,CALCULATE Noornilo Nafees

Guideline for writing Pseudocode Steps should be understandable Capitalize the keyword. Indent to show hierarchy. End multiple line structure etc,. Noornilo Nafees

Example READ a,b C=a+b WRITE C stop Noornilo Nafees

Example READ a,b IF a>b PRINT a is greater ELSE PRINT b is greater ENDIF stop Noornilo Nafees

Advantage & Disadvantage It can be easily modified It can be understood easily Compare to flowchart it is difficult to understand the program logic. Noornilo Nafees

Flowcharts It is the pictorial representation of the process. It describes the sequence & flow of control & information in a process It uses different symbols for depicting different activities Noornilo Nafees

Flowchart Symbols Terminal symbol It is used to represent the start, end of the program logic. Input/Output It is used for input or output. Process Symbol It is used to represent the calculations, data movements, initialization operations etc,. Noornilo Nafees

Decision Symbol It is used to denote a decision to be made at that point Flow lines It is used to connect the symbols Connectors It is used to connect the flow lines. Loop It is used to denote loops involved in the process. Noornilo Nafees

Guidelines for preparing flowcharts It should be clear and easy to follow Standard symbols should be used. The flow lines should not intersect each others. In case of complex flowcharts use the connectors symbols. Direction of flow of procedure is from left to right or top to bottom It must have one logical start and end. Noornilo Nafees

Only one flow line used with the terminal symbol. Only one flow line should enter the process symbol and only one flow line should come out from a process symbol. Only one flow line used with the terminal symbol. START STOP Noornilo Nafees

Only one flow line should enter the decision symbol and two or three flowlines may leave from the decision symbol. Noornilo Nafees

Benefits of Flowcharts Communication Effective Analysis Proper Documentation Efficient Coding Proper Debugging Efficient Program Maintenance Noornilo Nafees

Limits of Flowcharts It is difficult to use flowcharts for large program Difficult to modify Complex logics are difficult to understand Noornilo Nafees

Design Structures Sequence control structure Flow chart Pseudocode Process 1 Process 2 Process n Process 1 Process 2 Process n Noornilo Nafees

Design Structures Sequence control structure The instructions are computed in sequence i.e. it performs instruction one after another. It uses top-down approach. Noornilo Nafees

Example START Read a,b C=a+b Print c STOP Noornilo Nafees

SELECTION CONTROL STRUCTURE It is used for making decisions. It allows the program to make a choice from alternative paths. IF …THEN IF …THEN… ELSE CASE etc., Noornilo Nafees

IF…THEN Pseudocode Flow chart IF condition THEN process 1 . . END IF YES Process 1 NO Noornilo Nafees

Example Start Read a If a>0 Stop yes no Print a is Positive Noornilo Nafees

IF…THEN…ELSE Pseudocode Flowchart IF condition THEN process 1 . ELSE . END IF If condition YES NO Process 1 Process 2 Noornilo Nafees

Example Start Read a,b If a>b Stop yes no Print a is Greater Print b is Greater Stop Noornilo Nafees

CASE structure Pseudocode Flow chart CASE Type Case Type-1: Process 1 . CASE Type Case Type-1: Process 1 Case Type-2: Process 2 Case Type-n: Process n END CASE Type 1 yes Process 1 no yes Type 2 Process 2 no Type 3 yes Process 3 no Noornilo Nafees

Example: Finding the Grade start Read m1,m2,m3 Avg=(m1+m2+m3)/3 If Avg>=60 Print First Class If Avg>=50 Print Second Class If Avg>=35 Print Third Class Fail Noornilo Nafees stop

Looping control structure It is used to execute some instructions several time based on some condition. WHILE loop Do…WHILE loop etc., Noornilo Nafees

WHILE Loop Pseudocode Flow chart WHILE condition Body of the loop . WHILE condition Body of the loop END WHILE condition no yes Body of The loop Noornilo Nafees

Example Start Num=0 Num<5 Num=Num+1 stop while no yes Print Num Noornilo Nafees

DO…WHILE Loop Pseudocode Flow chart DO . Body of the loop WHILE condition END WHILE Body of The loop yes condition no Noornilo Nafees

Example Start Num=0 Num=Num+1 yes while Num<5 no Print Num stop Noornilo Nafees

Example: Finding the area of a circle Algorithm Step1: Start Step2: Read the value of r Step3: Calculate area Step4: Print area Step5: Stop Noornilo Nafees

Pseudocode Set area READ r COMPUTE area=3.14*r*r PRINT area stop Noornilo Nafees

Flowchart START Read r area=3.14*r*r Print area STOP Noornilo Nafees

Find the largest among three Numbers Algorithm Step1: Start Step2: Read the value of a, b, c Step3: IF (a>b) and (a>c) THEN print a is largest ELSE IF (b>c) THEN print b is largest ELSE print c is largest Step4: Stop Noornilo Nafees

Pseudocode READ a, b, c IF (a>b) and (a>c) THEN WRITE a is largest ELSE IF (b>c) THEN WRITE b is largest ELSE WRITE c is largest ENDIF stop Noornilo Nafees

Flowchart START Read a,b,c If (a>b) and (a>c) Print a Is largest yes Print a Is largest no yes If b>c Print b Is largest no Print c Is largest Noornilo Nafees stop

Finding roots of the Quadratic equation Step:1 Start Step:2 Enter the values of a,b,c Step:3 Find the value of D Using the Formula, D = b*b-4*a*c Step:4 If D is greater than or equal to zero find 2 roots root1(-b+sqrt(D))/(2*a) root2(-b-sqrt(D))/(2*a) Step:5 Print root1 & root2 Step:6 If D is less than zero, then print the roots are imaginary Step:7 Stop Noornilo Nafees

Pseudocode Set root1,root2 READ the value of a, b, c Find D b*b-4*a*c IF D>=0 THEN calculate root1=(-b+sqrt(D))/(2*a) root2=(-b-sqrt(D))/(2*a) ELSE Roots are imaginary END IF WRITE root1,root2 Stop Noornilo Nafees

Flow chart Start Read a,b,c D=b*b-4*a*c If D>=0 no If D>=0 yes Root1=[-b+sqrt(D)]/(2*a) Root2=[-b+sqrt(D)]/(2*a) Print roots are imaginary Print root1,root2 Noornilo Nafees Stop

Swapping two variables Algorithm Step1: Start Step2: Read the value of a, b Step3: c = a a = b b = c Step4: Print the value of a and b Step5: Stop Noornilo Nafees

Pseudocode READ the value of a, b To swap use c = a a = b b = c WRITE a, b stop Noornilo Nafees

Flowchart START Read a, b c = a a = b b = c Print a, b STOP Noornilo Nafees

Swapping two variables without using another variable Algorithm Step1: Start Step2: Read the value of a, b Step3: a = a + b b = a - b a = a - b Step4: Print the value of a and b Step5: Stop Noornilo Nafees

Pseudocode READ the value of a, b To swap use a = a + b b = a - b WRITE a, b stop Noornilo Nafees

Flowchart START Read a, b a = a + b b = a - b a = a - b Print a, b STOP Noornilo Nafees

Finding the year is leap year or not Algorithm Step1: Start Step2: Read the value of year Step3: IF year % 4 ==0 THEN print It is a Leap year ELSE print It is not a Leap year Step4: Stop Noornilo Nafees

Pseudocode READ year IF year % 4 ==0 THEN WRITE It is a Leap year ELSE WRITE It is not a Leap year ENDIF stop Noornilo Nafees

Flowchart Start Read year year % 4 ==0 Stop yes no Print It is a Leap year Print It is not a Leap year Stop Noornilo Nafees

Finding the Factorial Algorithm Step1: Start Step2: Read the value of n and set i =1 Step3: While i <= n do fact =fact * i i = i + 1 else Goto step5 Step4: Goto step 3 Step5: print the value of fact Step6: Stop Noornilo Nafees

Pseudocode READ the value of n and set i =1 WHILE (i <= n) do fact =fact * i i = i + 1 ENDWHILE Repeat the loop until condition fails WRITE fact stop Noornilo Nafees

Flowchart Start Read n i = 1 i<=n fact=fact * i i=i+1 stop while no yes fact=fact * i i=i+1 Print fact stop Noornilo Nafees

Finding the Sum of the digits Algorithm Step1: Start Step2: Read the value of n and set i = 0, sum = 0 Step3: While n>0 do r=n%10 sum=sum + r n=n/10 else Goto step5 Step4: Goto step 3 Step5: print the value of sum Step6: Stop Noornilo Nafees

Pseudocode READ the value of n and set i =0, sum=0 WHILE (n>0) do r=n%10 sum=sum + r n=n/10 ENDWHILE Repeat the loop until condition fails WRITE sum stop Noornilo Nafees

Flowchart Start Read n r = 0,sum=0 n>0 r=n%10 sum=sum + r n=n/10 while n>0 no yes r=n%10 sum=sum + r n=n/10 Print sum Noornilo Nafees stop

Finding the Reverse of a Number Algorithm Step1: Start Step2: Read the value of n and set i = 0, sum = 0 Step3: While n>0 do r=n%10 sum=sum *10 + r n=n/10 else Goto step5 Step4: Goto step 3 Step5: print the value of sum Step6: Stop Noornilo Nafees

Pseudocode READ the value of n and set i =0, sum=0 WHILE (n>0) do r=n%10 sum=sum *10 + r n=n/10 ENDWHILE Repeat the loop until condition fails WRITE sum stop Noornilo Nafees

Flowchart Start Read n r = 0,sum=0 n>0 r=n%10 sum=sum *10 + r while n>0 no yes r=n%10 sum=sum *10 + r n=n/10 Print sum Noornilo Nafees stop

Armstrong Number Example: 153 13 +53 + 33 =153 Noornilo Nafees

Finding an Armstrong Number Algorithm Step1: Start Step2: Read the value of n and set a = n, sum = 0 Step3: While n>0 do r=n%10 sum=sum + r*r*r n=n/10 else Goto step5 Step4: Goto step 3 Step5: If a = sum then Print Armstrong Number Else Print It is Not an Armstrong Number Endif Step6: Stop Noornilo Nafees

Pseudocode READ the value of n and set a =n, sum=0 WHILE (n>0) do r=n%10 sum=sum + r*r*r n=n/10 ENDWHILE Repeat the loop until condition fails IF a=sum THEN WRITE Armstrong Number ELSE WRITE It is not an Armstrong Number ENDIF stop Noornilo Nafees

Flowchart Start Read n a = n,sum=0 n>0 r=n%10 sum=sum + r*r*r while n>0 no yes r=n%10 sum=sum + r*r*r n=n/10 if a=sum Print It is Not an Armstrong No Print Armstrong No Noornilo Nafees stop

Fibonacci series Example: 0 1 1 2 3 5 8 11…. Noornilo Nafees

Finding the Fibonacci series Algorithm Step1: Start Step2: Read the value of n and set f=0,f1=-1, f2=1 Step3: While (f<n) do f=f1+f2 f1=f2 f2=f Print f else Goto step5 Step4: Goto step 3 Step5: Stop Noornilo Nafees

Pseudocode READ the value of n and set f=0 ,f1=-1, f2=1 WHILE (f<n) do f=f1+f2 f1=f2 f2=f WRITE f ENDWHILE Repeat the loop until condition fails stop Noornilo Nafees

Flowchart Start Read n f=0,f1= -1,f2=1 f<n f=f1+f2 f1=f2 f2=f stop while f<n no yes f=f1+f2 f1=f2 f2=f Print f Noornilo Nafees stop

Conversion of Celsius to Fahrenheit Algorithm Step1: Start Step2: Read the value of Celsius Step3: Fahrenheit = (1.8* Celsius) + 32 Step4: Print Fahrenheit Step5: Stop Noornilo Nafees

Pseudocode Set Fahrenheit READ the Celsius COMPUTE Fahrenheit = (1.8* Celsius) + 32 PRINT Fahrenheit stop Noornilo Nafees

Fahrenheit = (1.8* Celsius) + 32 Flowchart START Read Celsius Fahrenheit = (1.8* Celsius) + 32 Print Fahrenheit STOP Noornilo Nafees

Conversion of Fahrenheit to Celsius Algorithm Step1: Start Step2: Read the value of Fahrenheit Step3:Calculate Celsius =(Fahrenheit – 32)/1.8 Step4: Print Celsius Step5: Stop Noornilo Nafees

Pseudocode Set Celsius READ the Fahrenheit COMPUTE Celsius =(Fahrenheit – 32)/1.8 PRINT Celsius stop Noornilo Nafees

Celsius =(Fahrenheit – 32)/1.8 Flowchart START Read Fahrenheit Celsius =(Fahrenheit – 32)/1.8 Print Celsius STOP Noornilo Nafees

Finding the sum of odd number between 1 to n Algorithm Step1: Start Step2: Read the value of n and set sum=0,i=1 Step3: While (i<=n) do sum=sum+i i=i+2 else Goto step5 Step4: Goto step 3 Step5: Print sum Step6: Stop Noornilo Nafees

Pseudocode READ the value of n and set sum=0,i=1 WHILE (i<=n) do sum=sum+i i=i+2 ENDWHILE Repeat the loop until condition fails WRITE sum stop Noornilo Nafees

Flowchart Start Read n sum=0,i=1 sum=sum+i i=i+2 stop Print sum While i<=n sum=sum+i i=i+2 Print sum stop Noornilo Nafees

Finding the sum of even number between 1 to n Algorithm Step1: Start Step2: Read the value of n and set sum=0,i=0 Step3: While (i<=n) do sum=sum+i i=i+2 else Goto step 5 Step4: Goto step 3 Step5: Print sum Step6: Stop Noornilo Nafees

Pseudocode READ the value of n and set sum=0,i=0 WHILE (i<=n) do sum=sum+i i=i+2 ENDWHILE Repeat the loop until condition fails WRITE sum stop Noornilo Nafees

Flowchart Start Read n sum=0,i=0 While i<=n sum=sum+i i=i+2 stop Print sum stop Noornilo Nafees

Conversion of Binary number to Decimal Algorithm Step1: Start Step2: Read the value of n and set i = 0, sum = 0 Step3: While n>0 do r=n%10 sum=sum + r*pow(2,i) n=n/10 i=i+1 else Goto step5 Step4: Goto step 3 Step5: print the value of sum Step6: Stop Noornilo Nafees

Pseudocode READ the value of n and set i =0, sum=0 WHILE (n>0) do r=n%10 sum=sum + r*pow(2,i) n=n/10 i=i+1 ENDWHILE Repeat the loop until condition fails WRITE sum stop Noornilo Nafees

Flowchart Start Read n sum=0,i=0 While n>0 r=n%10 sum=sum + r*Pow(2,i) n=n/10 i=i+1 Print sum stop Noornilo Nafees