31.0k views
2 votes
Write a method called allDigitsOdd that returns whether every digit of a positive integer is odd. Return true if the number consists entirely of odd digits (1, 3, 5, 7, 9) and false if any of its digits are even (0, 2, 4, 6, 8). For example, the call allDigitsOdd(135319) returns true but allDigitsOdd(9145293) returns false.

User Kazhiu
by
5.8k points

1 Answer

3 votes

Answer:

Sample output:

Enter integer 3232423

true

Enter integer 12131231

false

Step-by-step explanation:

Above is the output of the program and for the solution check the screenshots attach to understand clearly the program.

Thanks

Write a method called allDigitsOdd that returns whether every digit of a positive-example-1
Write a method called allDigitsOdd that returns whether every digit of a positive-example-2
Write a method called allDigitsOdd that returns whether every digit of a positive-example-3
Write a method called allDigitsOdd that returns whether every digit of a positive-example-4
User Hanzallah Afgan
by
5.2k points