Assignment Solution

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

1).

Algorithm & Flowchart to convert temperature from Celsius to


Fahrenheit

C : temperature in Celsius
F : temperature Fahrenheit

Algorithm

Step-1: Start

Step-2:Input temperature in Celsius say C

Step-3:F = (9/5 x C) + 32

Step-4:Display Temperature in Fahrenheit F

Step-5: Stop

Flowchart
Start

Input value of C

F=(9/5*C)+32

Print F

Stop

2). No Solution
4).Algorithm & Flowchart to Swap Two Numbers using temporary third
Variable

Algorithm

Step-1: Start

Step-2: Input Two Numbers Say NUM1,NUM2

Step-3: Display Before Swap Values NUM1, NUM2

Step-4:TEMP = NUM1

Step-5:NUM1 = NUM2

Step-6:NUM2 = NUM1

Step-7:Display After Swap Values NUM1,NUM

Step-8: Stop

Flowchart

Start

Input value of
Num1,Num2

Display Value of
Num1,Num2 before
swap

Temp=Num1
Num1=Num2
Num2=Temp

Display value of
Num1 ,Num2 after
swap

Stop
5). Algorithm & Flowchart to Swap Two Numbers without using third
variable

Algorithm

Step-1: Start

Step-2:Input Two Numbers Say A,B

Step-3:Display Before Swap Values A, B

Step-4:A = A + B

Step-5:B = A - B

Step-6:A = A - B

Step-7:Display After Swap Values A, B

Step-8: Stop

Flowchart:

Start

Input value of
A, B

Display Value of
A, B before swap

A=A+B
B=A-B
A=A-B

Display value of
A,B after swap

Stop
6). Algorithm and draw flowchart that read 10 integers from the keyboard in the range 0- 100,
and count how many of them are larger than 50, and display this result

ALGORITHM
Step1; Start
Step2: Number=0
Step3: For i=1,10
Display Number
Step4:X=-1
Step5: If X<0 and X>100 then
Input X
Step6: If X>50 then
Number=Number + 1

Step7: Go to Step3
Step 8: End

Flowchart

Start

Number=0;

i=1,10

Output
X=-1
Number

X<0 or X>100 End

Input x
X>50

Number=Number+1;
7). Algorithm & Flowchart to find Factorial of number

Algorithm

Step-1: Start

Step-2:Read number N

Step-3:FACT=1 CTRL=1
Step-4;WHILE (CTRL <= N)
DO
FACT=FACT*I
CTRL=CTRL+1
DONE
Step-5:Display FACT

Step-6: Stop

You might also like