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]
4 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]4 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
Does anyone know edhesive 4.3 question 1
navik [9.2K]

No

.................................. :)

5 0
3 years ago
Read 2 more answers
Suppose a computer has 16-bit instructions. The instruction set consists of 32 different operations. All instructions have an op
Kazeer [188]

Answer:

2^7= 128

Explanation:

An instruction format characterizes the diverse part of a guidance. The fundamental segments of an instruction are opcode and operands. Here are the various terms identified with guidance design:  Instruction set size tells the absolute number of guidelines characterized in the processor.  Opcode size is the quantity of bits involved by the opcode which is determined by taking log of guidance set size.  Operand size is the quantity of bits involved by the operand.  Guidance size is determined as total of bits involved by opcode and operands.

6 0
4 years ago
Maria is starting a pet hotel and needs a website to promote her business and establish her brand. Which of the following is the
german

<em>The answer is </em><em>C. Maria should use turnkey solution that will allow her to use templates and management tools to create a site. </em>

<em> </em>

<em>Turnkey solution</em><em> is a type of business solution that can allow business owners to use these ready-made tools, templates and system to their existing process and business operations. Such tools include </em><em>CRM </em><em>and websites. For example, you are in need of a Loans Management System, that must be implemented next week. You can browse for Loans CRM that are widely available on the internet, subscribe to the service, make payment and this could be used right away in your business operation. Same thing with Maria's needs on the website. She could just subscribe to a website that can allow her to create pages and links with drag and drop and make it running right away.</em>

8 0
3 years ago
Given an char variable last that has been initialized to a lowercase letter, write a loop that displays all possible combination
Amanda [17]

Answer:

for (char outerChar='a'; outerChar<='e'; outerChar++){

for (char innerChar='a'; innerChar<='e'; innerChar++){

cout << outerChar << innerChar << "\n";

}

}

5 0
3 years ago
Some request lists might cause the disk scheduler to act the same when the three different algorithms are run. Create a request
storchak [24]

Answer:

35, 25, 50, 75, 95

Explanation:

List of five track numbers that will cause all three algorithms to visit the same tracks in the same order are -

35

25

50

75

95

Please go to attachment for the diagram how these 5 tracks will be traversed by various algorithms.

All the algorithms traverse in the order 35 -> 25 -> 50 -> 75 -> 95

7 0
3 years ago
Other questions:
  • ____ is used specifically for the purpose of recording keystrokes, logging the programs or web sites accessed, or otherwise moni
    8·2 answers
  • 38. Which of the following best describes why e-mail spoofing is easily executed? a. SMTP lacks an adequate authentication mecha
    15·1 answer
  • Keisha wants to change the font color on the 1st and 3rd bullet items on slide 6 of her allied health presentation. what is the
    14·1 answer
  • Why are some constraints automatically applied by the software
    9·1 answer
  • An attacker sets up a look-alike wi-fi network, tempting unsuspecting users to connect with the attacker's wi-fi network instead
    5·1 answer
  • Which sentence best describes a lifestream?
    8·2 answers
  • Bill is building a project network that involves testing a prototype. he must design the prototype (activity 1), build the proto
    5·1 answer
  • To answer the research question "How am I going to find the information I need on the tople?" the best thing Georgia should
    15·1 answer
  • A computer projecter is an example of a(n):<br> Input Device<br> Output Device<br> Storage Device
    12·2 answers
  • Input images into a computer
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!