0% found this document useful (0 votes)
55 views

Lab Task No#1: Problem#1 Write An Algorithm and Draw The Flowchart For Finding The Average of Two Numbers

The document contains 8 problems describing algorithms and code snippets to solve tasks such as finding the average of two numbers, calculating the area of a rectangle, determining a person's age when they turn 100, formatting and printing strings, displaying the current date and time, calculating the area of a circle based on radius input, reversing and printing a user's first and last name, printing a calendar for a given month and year, converting between Celsius and Fahrenheit, and calculating the volume of a sphere. The document also includes 5 programming exercises involving similar tasks.

Uploaded by

ayaan khan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views

Lab Task No#1: Problem#1 Write An Algorithm and Draw The Flowchart For Finding The Average of Two Numbers

The document contains 8 problems describing algorithms and code snippets to solve tasks such as finding the average of two numbers, calculating the area of a rectangle, determining a person's age when they turn 100, formatting and printing strings, displaying the current date and time, calculating the area of a circle based on radius input, reversing and printing a user's first and last name, printing a calendar for a given month and year, converting between Celsius and Fahrenheit, and calculating the volume of a sphere. The document also includes 5 programming exercises involving similar tasks.

Uploaded by

ayaan khan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

LAB TASK NO#1

Problem#1
Write an algorithm and draw the flowchart for finding the average of two
numbers.
Algorithm:

Input: two numbers x and y

Output: average of x and y

Steps:

1. input x

2. input y

3. sum = x + y

4. average = sum /2

5. output average

START

Input x

Input y

Sum = x + y

Average = sum/2

Output

Average

END
Average of two numbers:

CODE INPUT:

CODE OUTPUT:
Problem#2
Write an algorithm for finding the area of a rectangle.
Algorithm:

Input: two numbers length and width

Output: area of rectangle

Steps:

1. input length

2. input width

3. area=length*width

4. Output area

Start

Input length

Input width

Area=length*width

Output Area

End
Problem#3
Program that tells the person the year he/she will turn 100 years old.

CODE INPUT:

CODE OUTPUT:
Problem#4
Printing the string in a specific format
CODE INPUT:

CODE OUTPUT:
Problem#5
Write a Python program to display the current date and time.

CODE INPUT:

CODE OUTPUT:
Problem#6
Write a Python program which accepts the radius of a circle from the
user and compute the area.
CODE INPUT:

CODE OUTPUT:
Problem#7
Write a Python program which accepts the user's first and last name and print
them in reverse order with a space between them.

CODE INPUT:

CODE OUTPUT:
Problem#8
Write a Python program to print the calendar of a given month and year.
Note: Use 'calendar' module

CODE INPUT:

CODE OUTPUT:
Programming exercise#1
1.Write a program for converting Centigrade into Fahrenheit.

CODE INPUT:

CODE OUTPUT:
FLOWCHART:

Start

Input temperature in

Degree Centigrade

Fahrenheit=(Celsius*9/5) +32

Output Fahrenheit

End
Programming exercise#2
Write a program for converting Fahrenheit into Centigrade.

CODE INPUT:

CODE OUTPUT:
FLOWCHART:

Start

Input temperature in

Fahrenheit

Celsius=(Fahrenheit-32) *(5/9)

Output Celsius

End
Programming exercise#3
Write a program to calculate the area of a rectangle.

CODE INPUT:

CODE OUTPUT:
FLOWCHART:

Start

Input length

Input width

Area=length*width

Output Area

End
Programming exercise#4
4.Write a program to calculate the volume of a sphere.

CODE INPUT:

CODE OUTPUT:
FLOWCHART:

Start

Input radius

Volume = (4/3)*pi*radius**3

Output Volume

End
Programming exercise#5
Write a program that can write your name in lower case, upper case
and title case.

CODE INPUT:

CODE OUTPUT:

You might also like