Set 14
Set 14
import java.util.Scanner;
int zeroCount = 0;
if (binaryString.charAt(i) == '0') {
zeroCount++;
convertToBinaryAndCountZeros(number);
scanner.close();
Output
Q2
import java.util.Scanner;
// Function to check if the first string ends with the second string
if (str1.endsWith(str2)) {
return true;
return false;
System.out.println("Does the first string end with the second string? " + result);
scanner.close();
Output
Does the first string end with the second string? True
Does the first string end with the second string? false