day3

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

day3:

Description:
You are two positive integers upper and lower. Fins the sum of all the numbers that
are even-valued in the given range of upper and lower where both are inclusive.
Print -1 if upper and lower are less than zero.

Constraints:
upper, lower >= 0

Example:
Input:

10

20

Output:

90

Explanation:
Sum of even-valued elements between 10 and 20 is 10+12+14+16+18+20 = 90
-----------------------------------------------
2.Description:
Write a program to take input as a string from user and Task is to eliminate the
given two letters from the given words or sentences and display the resultant
words.

Constraints:
The input string may contain alphabetic characters (both uppercase and lowercase),
numbers, symbols, or spaces.
The input string length can range from 1 to 10^5 characters.
The letters to eliminate can be any alphabetic characters (both uppercase and
lowercase).
Example:
I/p:
Instacks

O/p:

Inack

Explanation:
In the given example 's' and 't' are removed from the given string
-----------------------------------------------------
3.Description:
Find if a number is a palindrome or not by following the below steps:

Read the number.


Find the sum of the number and the reverse of the number.
Check if the sum is a palindrome.
If it is a palindrome, print it; otherwise, repeat the steps until a palindrome is
found.
Input Format:

An integer representing the number.


Output Format:

Print the palindrome sum.


Constraints:
N > 0
Example:
Input:
87

Output:

4884

Explanation:
Sum of 87 and its reverse (78) is 87 + 78 = 165.
The reverse of 165 is 561.
The sum 561 is not a palindrome.
Repeat the steps: 561 + 165 = 726. The reverse of 726 is 627.
The sum 627 is not a palindrome.
Repeat the steps: 627 + 726 = 1353. The reverse of 1353 is 3531.
The sum 3531 is not a palindrome.
Repeat the steps: 3531 + 1353 = 4884. The reverse of 4884 is 4884.
The sum 4884 is a palindrome, so print 4884
---------------------------------------------

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy