1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
leonid [27]
3 years ago
6

Write a java program called allDigitsOdd that returns whether every digit of a positive integer is odd. Return true if the numbe

r 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.
Computers and Technology
1 answer:
Vlada [557]3 years ago
4 0

Answer:

public class Digits

{

   public static boolean allDigitsOdd(int num)

   {

       boolean flag=true;

       int rem;

       while(num>0)

       {

           rem=num%10;

           num=num/10;

           if(rem%2==0)    // if a even digit found immediately breaks out of loop

           {

               flag=false;

               break;

           }

       }

       return flag;     //returns result

   }

   public static void main(String args[])

   {

       System.out.println(allDigitsOdd(1375));    //returns true as all are odd digits

   }

}

OUTPUT :

true

Explanation:

Above program has 2 static methods inside a class Digits. Logic behind above function is that a number is divided by 10 until it is less than 0. Each time its remainder by 0 is checked if even immediately breaks out of the loop.

You might be interested in
Your new client's AdWords account has one campaign with one ad group that contains a list of hundreds of keywords. Which best pr
Degger [83]
<span>Create new ad groups with related keywords grouped together</span>
8 0
3 years ago
Universal Containers (UC) has decided to build a new, highly sensitive application on the Force platform. The security team at U
Tresset [83]

Use an AppExchange product that does fingerprint scanning with native Salesforce Identity  Confirmation

8 0
3 years ago
Need help with these
kolbaska11 [484]
The first one is d the second one is true the third one is false
3 0
3 years ago
Which are guidlines for using themes? Check all that apply
Andreyy89

Answer: A. Using different cell styles can help you differentiate different types of data.

B. Fonts should be easily readable and of appropriate size.

D. Be consistent with themes across worksheets and workbooks.

Explanation:

A theme refers to the preset package that contains functionality details and graphical appearance.

The guidelines for using themes include:

• Using different cell styles can help you differentiate different types of data.

• Fonts should be easily readable and of appropriate size.

• Be consistent with themes across worksheets and workbooks.

Therefore, the correct options are A, B and D.

7 0
3 years ago
What is all about programming interactions in the real world.
Lynna [10]

Answer:

Programming is everywhere in the modern world and meets you in the street, your workplace, and the local grocery store. You interact with bar-code scanners regularly, and you almost certainly use lots of code while working, whether you're using a word processor to write a letter or an email platform to send messages. Programs used in real-world environments should also be programmed in the real world, so we have developed a new programming paradigm, “Real-World Programming (RWP),” which enables users to make programs for handling real-world environments as well as data in computers

7 0
3 years ago
Other questions:
  • How useful do you find the creation of folders in your computer?
    8·2 answers
  • What does %d, , %c, %s mean and what's their difference?
    12·1 answer
  • Why is an ISA unlikely to change between successive generations of microarchitectures
    11·1 answer
  • While doing research on the Internet, what kind of website should you avoid because the information may be biased?
    11·1 answer
  • From Blown to Bits why is it important to know what children are doing on the Web Tonight?
    7·1 answer
  • Discuss how sentiment analysis works using big data?<br>​
    13·1 answer
  • In dynamic programming, the technique of storing the previously calculated values is called A. Saving value property B. Storing
    7·1 answer
  • Zara wants to create some lines of code that are ignored by the computer. What should these lines begin with?
    5·1 answer
  • How to convert binary to decimal <br> Please it’s so hard and what is digital and analogue
    9·1 answer
  • Your server runs in quadruple-channel memory mode. How many memory controllers are being used?.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!