Find the presence of smallest number in largest number in C/CPP

Problem Statement:

To find whether anyone integer value is present in another integer value. If anyone integer is present in another integer then display true or else display false.

Two integer numbers are given as 'a' and 'b'.

Ex1:

a=1212 b=12, Output: True

Ex2:

a=20 b=2309, Output: False

Explanation:

presence of one integer on another integer


  1. Find the smallest number.
  2. Calculate the length of the smallest number "b" and multiply it by 10 as "len".
  3. In a while loop, "rem" is the modular division(remainder value) of the largest integer "a" and length of the smallest integer "len".
  4. If the "rem" and the "b"(smallest integer) are the same then, break the loop and return true or else return false at the end.

Code(C/CPP):


Output:

Find the presence of second number in first number in CPP output
[You can mail us about your suggestions and feedback, these are very important to us]

Post a Comment

0 Comments