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
If you have related data stored in multiple tables, create a(n) ________ to produce a pivottable on the combined data.
vladimir1956 [14]
If you have related data stored in multiple tables, create a Data model to<span> produce a pivot table on the combined data.
In computer term, data model refers to how each data are connected to one another and how those connections are being processed within the Sysyem</span>
3 0
3 years ago
Does anyone play call of duty cold war campaign. I have a question, please help me.
-Dominant- [34]

Answer:

so please

Explanation:

please upload the question so I can answer ,by the way I don't play call of duty

5 0
3 years ago
Read 2 more answers
What is resource management in Wireless Communication? Explain its advantages
lubasha [3.4K]

Answer:

Wireless resources management is communication to address they faster response time.

Explanation:

Wireless communication that provide bandwidth, and transmission reliable, towards development.

This communication is discovered to the date and have consumed physical layer  of available wireless resources.

Wireless communication management all this critical topic  and the management techniques, and limited device battery power.

Communication as the address channel loss, and multi path .

Communication are the latest resources allocation and new or next generation and technologies.

Wireless communication theoretical concepts in a manner, and the necessary mathematical tools and fundamental tools.

Wireless communication device industries up to date of the topic,readers are benefit from a basic.

8 0
3 years ago
How telecommunications works?​
SIZIF [17.4K]

Answer:

Telecommunications are the means of electronic transmission of information over distances. The information may be in the form of voice telephone calls, data, text, images, or video. Today, telecommunications are used to organize more or less remote computer systems into telecommunications networks.

Explanation:

3 0
3 years ago
What is the difference between an optical drive and a solid state?
olga nikolaevna [1]
The answer to this question is B
6 0
3 years ago
Other questions:
  • Security awareness training can reduce the risk of a data breach by what percentage?
    12·1 answer
  • Briefly describe the client/server model.
    8·1 answer
  • A cell has an unlimited number of conditions for Conditional Formatting.<br> A.true<br> B.false
    7·1 answer
  • PLZ help
    5·1 answer
  • What formatting has been applied to this title?
    8·1 answer
  • An airline has found about 7% of its passengers request vegetarian meals. On a flight with 166 passengers the airline has 16 veg
    11·1 answer
  • Create a macro named mReadInt that reads a 16- or 32-bit signed integer from standard input and returns the value in an argument
    5·1 answer
  • How dose society use computer in government?​
    5·1 answer
  • def transfer(bank, log_in, userA, userB, amount): ''' In this function, you will try to make a transfer between two user account
    6·1 answer
  • You have a Mobile Legends account???<br>Can I play with You???​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!