Download presentation
Presentation is loading. Please wait.
1
Introduction To Computers
UNIT-I Introduction To Computers
2
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.
3
Definition Computer is an electronic device. It accepts data, process the data and gives the desired output. COMPUTER INPUT OUTPUT
4
Basic functions or operations
Input Processing Output Storing Controlling
5
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.
6
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.
7
Basic operations (Cont)
Controlling It is the process of directing the sequence in which the operations to be performed.
8
Applications of computer:
Business Industry Home Education Printing & publishing Entertainment etc.,
9
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
10
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
11
Basic organisation of computer
INPUT UNIT The input unit is used to feed information or instruction to the computer. Input Devices: Keyboard Mouse Scanner…
12
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
13
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
14
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.
15
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,.
16
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
17
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
18
Classification of Computer
19
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
20
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.
21
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…..
22
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….
23
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.
24
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.
25
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.
26
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).
27
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.
28
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
29
Generations of Computers
30
Generations of Computers (Cont)
First Generation Computers( ): 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.
31
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
32
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
33
Generations of Computers (Cont)
Second Generation Computers ( ) 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.
34
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
35
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
36
Generations of Computers (Cont)
Third Generation Computers ( ) 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.
37
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
38
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
39
Generations of Computers (Cont)
Fourth Generation Computers( ) 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.
40
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
41
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
42
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 .
43
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
44
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
45
NUMBER SYSTEM
46
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
47
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 (6x10^3)+(5x10^2)+(4x10^1)+(3x10^0)+(1x10^-1)+(2x10^-2)+(4x10^-3) =
48
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 (1x2^5)+(0x2^4)+(1x2^3)+(0x2^2)+(0x2^1)+(1x2^0)+(0x2^-1)+(1x2^-2)+(0x2^-3)+(1x2^-4) =
49
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) =
50
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 (2x8^2)+(1x8^1)+(5x8^0)+(4x8^-1)+(3x8^-2) =
51
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
52
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
53
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
54
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
55
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
56
Factors used to judge the algorithm
Time Memory Accuracy Sequence etc,. Noornilo Nafees
57
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
58
Pseudocode Pseudo means imitates and code means instruction.
It is formal design tool. It is also called Program Design Language. Noornilo Nafees
59
Keywords READ,GET PRINT,DISPLAY COMPUTE,CALCULATE Noornilo Nafees
60
Guideline for writing Pseudocode
Steps should be understandable Capitalize the keyword. Indent to show hierarchy. End multiple line structure etc,. Noornilo Nafees
61
Example READ a,b C=a+b WRITE C stop Noornilo Nafees
62
Example READ a,b IF a>b PRINT a is greater ELSE PRINT b is greater ENDIF stop Noornilo Nafees
63
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
64
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
65
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
66
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
67
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
68
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
69
Only one flow line should enter the decision symbol and two or three flowlines may leave from the decision symbol. Noornilo Nafees
70
Benefits of Flowcharts
Communication Effective Analysis Proper Documentation Efficient Coding Proper Debugging Efficient Program Maintenance Noornilo Nafees
71
Limits of Flowcharts It is difficult to use flowcharts for large program Difficult to modify Complex logics are difficult to understand Noornilo Nafees
72
Design Structures Sequence control structure Flow chart Pseudocode
Process 1 Process 2 Process n Process 1 Process 2 Process n Noornilo Nafees
73
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
74
Example START Read a,b C=a+b Print c STOP Noornilo Nafees
75
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
76
IF…THEN Pseudocode Flow chart IF condition THEN process 1 . . END IF
YES Process 1 NO Noornilo Nafees
77
Example Start Read a If a>0 Stop yes no Print a is Positive
Noornilo Nafees
78
IF…THEN…ELSE Pseudocode Flowchart IF condition THEN process 1 . ELSE
. END IF If condition YES NO Process 1 Process 2 Noornilo Nafees
79
Example Start Read a,b If a>b Stop yes no Print a is Greater
Print b is Greater Stop Noornilo Nafees
80
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
81
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
82
Looping control structure
It is used to execute some instructions several time based on some condition. WHILE loop Do…WHILE loop etc., Noornilo Nafees
83
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
84
Example Start Num=0 Num<5 Num=Num+1 stop while no yes Print Num
Noornilo Nafees
85
DO…WHILE Loop Pseudocode Flow chart DO . Body of the loop
WHILE condition END WHILE Body of The loop yes condition no Noornilo Nafees
86
Example Start Num=0 Num=Num+1 yes while Num<5 no Print Num stop
Noornilo Nafees
87
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
88
Pseudocode Set area READ r COMPUTE area=3.14*r*r PRINT area stop
Noornilo Nafees
89
Flowchart START Read r area=3.14*r*r Print area STOP Noornilo Nafees
90
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
91
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
92
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
93
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
94
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
95
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
96
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
97
Pseudocode READ the value of a, b To swap use c = a a = b b = c
WRITE a, b stop Noornilo Nafees
98
Flowchart START Read a, b c = a a = b b = c Print a, b STOP
Noornilo Nafees
99
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
100
Pseudocode READ the value of a, b To swap use a = a + b b = a - b
WRITE a, b stop Noornilo Nafees
101
Flowchart START Read a, b a = a + b b = a - b a = a - b Print a, b
STOP Noornilo Nafees
102
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
103
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
104
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
105
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
106
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
107
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
108
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
109
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
110
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
111
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
112
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
113
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
114
Armstrong Number Example: =153 Noornilo Nafees
115
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
116
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
117
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
118
Fibonacci series Example: …. Noornilo Nafees
119
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
120
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
121
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
122
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
123
Pseudocode Set Fahrenheit READ the Celsius
COMPUTE Fahrenheit = (1.8* Celsius) + 32 PRINT Fahrenheit stop Noornilo Nafees
124
Fahrenheit = (1.8* Celsius) + 32
Flowchart START Read Celsius Fahrenheit = (1.8* Celsius) + 32 Print Fahrenheit STOP Noornilo Nafees
125
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
126
Pseudocode Set Celsius READ the Fahrenheit
COMPUTE Celsius =(Fahrenheit – 32)/1.8 PRINT Celsius stop Noornilo Nafees
127
Celsius =(Fahrenheit – 32)/1.8
Flowchart START Read Fahrenheit Celsius =(Fahrenheit – 32)/1.8 Print Celsius STOP Noornilo Nafees
128
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
129
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
130
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
131
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
132
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
133
Flowchart Start Read n sum=0,i=0 While i<=n sum=sum+i i=i+2 stop
Print sum stop Noornilo Nafees
134
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
135
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
136
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.