Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ca8296d

Browse files
New Programs added.
1 parent 99387fc commit ca8296d

3 files changed

+51
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""
2+
Description:
3+
4+
Core logic is same as program#25.
5+
6+
In this program if we enter a number like 2345 so the program will calculate the sum of
7+
even numbers exist in the digit like in this case 2 and 4 are present as a even number in 2345
8+
so it means the sum = 2 + 4 = 6
9+
same the program will also calculate the product of odd numbers exist in the digit like in this case
10+
3 and 5 means the product = 3 * 5 = 15.
11+
"""
12+
13+
no = int(input('Enter Number: '))
14+
sum = 0
15+
product = 1
16+
while no > 0:
17+
d = no % 10
18+
if d % 2 == 0:
19+
sum = sum + d
20+
else:
21+
product = product * d
22+
no = no // 10
23+
print('The sum of even digits =', sum, 'and the product of odd digits =', product)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""
2+
Description:
3+
Reverse means if the user enters 287 then the output is 782.
4+
"""
5+
6+
no = int(input('Enter Number to find its reverse: '))
7+
rev = 0
8+
while no > 0:
9+
rev = (rev * 10) + (no % 10)
10+
no = no // 10
11+
print('The Reverse of a number is =', rev)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""
2+
Description:
3+
Palindrome numbers are those numbers in which if we find the reverse of number and the reverse is same as
4+
that of original number then the number is palindrome number.
5+
lets say if we choose 525 then the reverse of this number is also 525 then 525 is a palindrome number.
6+
"""
7+
8+
no = int(input('Enter Number to check whether it is palindrome or not: '))
9+
originalNo = no
10+
rev = 0
11+
while no > 0:
12+
rev = (rev * 10) + (no % 10)
13+
no = no // 10
14+
if originalNo == rev:
15+
print('The Number is a palindrome number.')
16+
else:
17+
print('The Number is not a palindrome number.')

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /