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

ICT Lab Report

Uploaded by

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

ICT Lab Report

Uploaded by

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

DEPARTMENT OF COMPUTER & SOFTWARE

ENGINEERING
COLLEGE OF E&ME, NUST, RAWALPINDI

LAB NO. 2

APPLICATIONS OF ICT
INTRODUCTION TO CONDITIONAL STATEMENTS AND LOGICAL OPERATIONS IN PYTHON.

SUBMITTED BY:
➢ SALMAN AHMAD KHAN

➢ M. MOBEEN ZAFAR

➢ AREESHA NAEEM

SUBMITTED TO:
➢ DR ASAD MANSOOR

➢ Ms. KASHAF RAHEEM

SUMISSION DATE:
06/10/2024
Degree/ Syndicate: CE-45-B
TOPIC
Condition Nesting And Looping.
OBJECTIVES:
• To have the understandings of basic syntax of python loops.
• introduction to the while loop.
HARDWARE/SOFTWARE USED:
Hardware: PC
Software: IDLE 3.12

TASKS:
Different tasks were assigned to grasp better understanding of the
above-mentioned. These tasks are as follows:

TASK:1:

Design an Algorithm and write a program in python to print multiplication


table (until 12) of a given number.

PSEUDO CODE:
Start.

Taking input from the user for the required table number and saving it in the
variable table.

Telling the user to initialize n=1.


Starting the while loop for n=1 to 12, 12 being the number of times we want to loop
the code.

Show n*x.

Display the product.

Show n=n+1, increment n.

If n>12 end the loop.

Flow chart:

Input:
Task 2:
• A person invests $𝟏𝟎𝟎𝟎 in a savings account yielding 𝟓% interest. Assuming that all
interest is left on deposit in the account, calculate and print the amount of money in the
account at the end of each year for 𝟏𝟎 years. Use the following formula for determining

these amounts:

𝑎=𝑝1+𝑟𝑛

• Where:

 p is the original investment (i.e., the principal)

 r is the annual interest rate

 n is the number of years

 a is the amount on deposit at the end of the 𝒏 𝒕𝒉 year


Input:

Output:

Task 3:
Write a program to check whether a number is Armstrong or not. (Armstrong number is a
number that is equal to the sum of cubes of its digits for example : 153 = 1^3 + 5^3 + 3^3).

Input:
Output:

Conclusion:

Basic python looping syntax was learnt during the lab in the third week. We
were introduced to a python loop called while loop in which you have to enter
a condition and the loop keeps on running unless the true result is gained.
Basic programs were created using while loop i.e.

 Number table.
 Calculating the interest for a specific amount with the specific percentage
for a number of years.

 Determining if an entered number is an Armstrong or not.

You might also like