given a binary pattern find out whether or t occurs in the number in c programming
Answers
Answered by
0
Answer:
Occurrences of a pattern in binary representation of a number
Given a string pat and an integer N, the task is to find the number of occurrences of the pattern pat in binary representation of N.
Examples:
Input: N = 2, pat = “101”
Output: 0
Pattern “101” doesn’t occur in the binary representation of 2 (10).
Input: N = 10, pat = “101”
Output: 1
Binary representation of 10 is 1010 and the given pattern occurs only once.
Similar questions