1.3 Algorithm
1.3 Algorithm
UNIT NO. 1
1.3 ALGORITHMS
I I
20ESCS101
PROBLEM SOLVING AND PROGRAMMING IN
C
(Common to CSE & IT)
20PCSPC101
ADVANCED DATA STRUCTURES AND ALGORITHMS
ALGORITHMS
Step 1 − START
Step 6 − print c
Step 7 − STOP
20ESCS101
PROBLEM SOLVING AND PROGRAMMING IN C (Common to CSE & IT)
Step-1 Start
Step-3 F = (9.0/5.0 x C) + 32
Step-5 Stop
20ESCS101
PROBLEM SOLVING AND PROGRAMMING IN C (Common to CSE & IT)
Step-1 Start
Step-2 Input Side Length of Square say L
Step-3 Area = L x L
Step-4 PERIMETER = 4 x L
Step-5 Display AREA, PERIMETER
Step-6 Stop
20ESCS101
PROBLEM SOLVING AND PROGRAMMING IN C (Common to CSE & IT)
Step 1: Start
Step 2: Declare variables a,b
Step 3: Read variables a,b
Step 4: If a > b
Display a is the largest number.
Else
Display b is the largest number.
Step 5: Stop
20ESCS101
PROBLEM SOLVING AND PROGRAMMING IN C (Common to CSE & IT)
Step 1: Start
Step 2: Declare variables a, b, c, D, x1, x2, rp and ip;
Step 3: Calculate discriminant
D ← b2-4ac
Step 4: If D ≥ 0
r1 ← (-b+√D)/2a
r2 ← (-b-√D)/2a
Display r1 and r2 as roots.
Else
Calculate real part and imaginary part
rp ← -b/2a
ip ← √(-D)/2a
Display rp+j(ip) and rp-j(ip) as roots
Step 5: Stop
20ESCS101
PROBLEM SOLVING AND PROGRAMMING IN C (Common to CSE & IT)
Step 1: Start
Step 2: Declare variables n, factorial and i.
Step 3: Initialize variables
factorial ← 1
i←1
Step 4: Read value of n
Step 5: Repeat the steps until i = n
5.1: factorial ← factorial*i
5.2: i ← i+1
Step 6: Display factorial
Step 7: Stop
20ESCS101
PROBLEM SOLVING AND PROGRAMMING IN C (Common to CSE & IT)
Step 1: Start
Step 2: Declare variables first_term,second_term and temp.
Step 3: Initialize variables first_term ← 0 second_term ← 1
Step 4: Display first_term and second_term
Step 5: Repeat the steps until second_term ≤ 1000
5.1: temp ← second_term
5.2: second_term ← second_term + first_term
5.3: first_term ← temp
5.4: Display second_term
Step 6: Stop
20ESCS101
PROBLEM SOLVING AND PROGRAMMING IN C (Common to CSE & IT)
Thank You