PROGRAMMING FUNDAMENTALS
WEEK 2
Name: Ehtesham Ul Hassan
Section: E
Roll: 190
Teacher: Prof. Ifra Shehzad
Objective: Problem-Solving with Flowcharting and Algorithms.
Draw flowcharts for input/output and basic math operations (add, subtract,
multiply).
Task 1: Make an algorithm and flowchart that asks the user to enter their
name and then displays it back.
Algorithm:
1. START
2. write “ Enter your name”
3. read name
4. write “ Hello there ”,name
5. END
Output:
Flowchart:
Task 2: Make a flowchart that asks the user to enter two numbers, adds them
together, and displays the result.
Algorithm:
1. START
2. write "Enter two numbers"
3. read A,B
4. sum=A+B
5. write "The sum of the two numbers is ", sum
6. END
Output:
Flowchart:
Task 3: Make a flowchart that asks the user to enter a number, calculates its
square, and displays the result.
Algorithm:
1. START
2. write “Enter a number”
3. read a
4. square =a*a
5. write "square is:",square
6. END
Output:
Flowchart:
Task 4: Make a flowchart and algorithm that converts a temperature from
Celsius to Fahrenheit using the formula:
F = (C × 9/5) + 32
Algorithm:
1. START
2. write "Enter temp in Celcius"
3. read C
4. F=(C*9/5)+35
5. write "Temperature in Fahrenheit is:",F
6. END
Output:
Flowchart:
Task 5: Write an algorithm that asks the user to enter two numbers, subtracts
the second number from the first, and displays the result.
Algorithm:
1. START
2. write "Enter two numbers"
3. read A,B
4. sub=A-B
5. write "Subtraction of numbers is: ",sub
6. END
Output:
Flowchart:
Task 6: Draw a flowchart that asks the user to enter three numbers, calculates
their average, and displays the result.
Algorithm:
START
write "Enter three numbers"
read A,B,C
average = (A+B+C)/3
write "Average of three numbers is: ", average
END
Output:
Flowchart: