Check if a given string is binary or not.

In this program, we will take a string as input and check if a given string is binary or not.

Steps to solve the program
  1. Take a string as input.
  2. Create a variable count and assign its value equal to 0.
  3. Use for loop to iterate over each character in the string.
  4. If the character is 0 or 1 then add 1 to the count variable.
  5. If the value of the count variable is equal to the length of the string then string is binary.
  6. Print the output.

Output :

remove the kth element from the string

add ‘ing’ at the end of the string

Leave a Comment