Page 343 - Information_Practice_Fliipbook_Class11
P. 343
reverseNum = 0
remainder = 0
while num > 0:
remainder = num %10
reverseNum = reverseNum * 10 + remainder
num //= 10
if n == reverseNum:
print(n, 'is palindrome')
else:
print(n, 'is not palindrome')
Program 7: To accept a number and display sum of squares of all even numbers till that number.
Ans. '''
Objective : To accept a number and display sum of squares of all even numbers
till that number
Input : num – numeric value
Output : sum of squares
'''
num = int(input("Enter a number : "))
sum = 0
for a in range(0,num + 1,2):
sum = sum + a * a
print("The sum is ", sum)
Program 8: Write a program that accepts a number, n and displays the following pattern.
Ans. '''
Objective: To display the triangle pattern
Input: n – numeric value
Practical 329

