Integer – Exactly Three Digits

The program must accept an integer N as the input. The program must print yes if exactly three digits are used to form the integer N. Else the program must print no as the output.The program must accept N string values and sort them. Then the program must print the first and the last string values.

Input :

1221255

Output :

yes

Explanation:
Here the integer 1221255 is formed using exactly three digits 1, 2 and 5.
Hence the output is yes

Here are the various methods and logic.

C++ :

Capture 9
#C++ code by Agent Wanda

Python :

IMG 20200420 WA0000
#Python code by Agent Stark
IMG 20200420 WA0001
#Python code by Agent Hawkeye
Capture 7
#Python code by Agent Parker
IMG 20200420 WA0029
#Python code by Cherry
IMG 20200420 WA0030
#Python code by Agent Cherry
IMG 20200420 WA0031
#Python code by Agent Cherry

C :

IMG 20200420 WA0040
#C code by Agent Steve
IMG 20200420 WA0032
#C code by Agent Falcon
Previous Article

Expand String - K Characters

Next Article

Integers - Equal to Index

Write a Comment

Leave a Comment

Your email address will not be published. Required fields are marked *