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

CSCI101 Lab01 FirstProgram

Uploaded by

s-zeyad.mawjoud
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

CSCI101 Lab01 FirstProgram

Uploaded by

s-zeyad.mawjoud
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

University of Science and Technology

Communications & Information Engineering Program


CSCI 101: Introduction to Computer Science
First Program

Write Python programs to:


1. Calculate and print the area of a circle. 𝐴𝑟𝑒𝑎 = 𝜋𝑟 2

2. Calculate and print the area of a triangle. Area = 0.5*base* height

3. Calculate and print the average of 3 numbers. Avg = (x+y+z)/3

4. Calculate and print the distance between two points (x1,y1) and (x2,y2)
𝐷𝑖𝑠𝑡 = √(𝑥2 − 𝑥1 )2 + (𝑦2 − 𝑦1 )2

5. Given number of weeks, calculate and print the number of minutes.

6. Calculate and print the number of days in N hours and the remaining hours.

7. Calculate and print the number of trays, N, needed to hold X glasses if each tray
contains Y glasses.

8. If you distribute N apples in groups of 7 apples each, how many groups will contain
exactly 7 apples and how many apples remain?

9. Display N grams in the form of number of kilograms and number of grams.

10. Given temperature values in Celsius units (Tc), calculate the corresponding values
of Kelvin units (Tk) according to the following relations.

TF = TR − 459.67
9
TF = TC + 32
5
9
TR = TK
5

Page 1
University of Science and Technology
Communications & Information Engineering Program
CSCI 101: Introduction to Computer Science
First Program

11. Write a program that reads two values, X and Y, from the user. The program then
swaps the values of X and Y. You should print the values of X and Y before and
after swap.
Example:
Enter x:10
Enter y:20
Before swap: x=10, y =20
After swap: x=20, y =10

12. Write a program that asks the user for three one-digit numbers and then uses them
as units, tens, and hundreds to evaluate one 3-digit number out of them
Example:
Please enter units: 5
Please enter tens: 2
Please enter hundreds: 9
The number is: 925

Page 2

You might also like