Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
3 views

Python Worksheet Template Lab[1] Anshul[2]

This document is a worksheet for a Python programming assignment focused on creating an Armstrong number checker. It includes sections for student details, aims, requirements, procedures, outputs, and learning outcomes. The problem statement outlines the steps to validate a positive integer and check if it is an Armstrong number using a specific coding solution.

Uploaded by

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

Python Worksheet Template Lab[1] Anshul[2]

This document is a worksheet for a Python programming assignment focused on creating an Armstrong number checker. It includes sections for student details, aims, requirements, procedures, outputs, and learning outcomes. The problem statement outlines the steps to validate a positive integer and check if it is an Armstrong number using a specific coding solution.

Uploaded by

at0389164
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING

Worksheet 1

Student Name: Anshul Soni


Keshav Singh UID: 23BCS13007
12985
23BCS12988
Branch : CSE Section/Group: 801-B
Semester: 3rd Subject Code :23CSP201
Subject Name: Python -programming Date : 01/08/2024.

1. Aim:

2. Requirements (Hardware/Software):

3. Procedure:

4. Output:

5. Learning Outcome:
Department of Computer Science & Engineering
INDEX
Ex List of Condu Viva Record Total Remark
p. Experiments ct (M.M:8) (M.M:) (M.M:3 s
No (M.M: 0)
12)
➢ SET-B: Problem Statements :
Set B: Armstrong Number Checker

Background: You are creating a program to check if a given number is an


Armstrong number or not

Requirements:

Accept a positive integer from the user.

2. Calculate the sum of cubes of its digits.

3. Determine if the number is an Armstrong number.

4. Display the result.

Conditions:

Use int for all calculations.

Implement input validation for positive integers.

Use a while loop to extract digits.

Use the operator for cube calculation.

Expected Output:

Prompt for a numbe


Display whether the number is an Armstrong number or Not
➢ PROBLEM SOLUTION
CODE :
Calculating the number is armstrong or not done in LAB

#user se input liya


n = int(input("Enter a number: "))

#sum ko hmne intilise kr dia


s=0
#copy of n ko hmne store kr dia
t=n
#conditon check for only positive number
n> 0
#while loop user for condition check
while t > 0:
#modulus open krta hai jo remainder deta hai
digit = t % 10
s += digit ** 3
t //= 10
# display the result
if n == s:
print(n,"is an Armstrong number")
else:
print(n,"is not an Armstrong number")
OUTPUT OF PROGRAM.

You might also like