Create a Boolean function odd_number_digits(n) that returns True when a positive integer has an odd number of digits. (You may assume that I will not use a number greater than 1,000,000.) Then, use it to make a
function sum_odd_digits(n) that sums all the numbers from 0 to n that have an odd number of digits.

Answers

Answer 1

Answer:

Following are the code to this question:

import java.util.*;//import package for user input

public class Main//defining class main

{

   public static boolean odd_number_digits(int n)//defining boolean method odd_number_digits

   {

       if(n>0 && n%2!=0)//defining if block that check value is positive and odd number

       {

       return true;//return value true

       }

       else//defining else block

       {

           return false;//return false value

       }

   }

   public static void  sum_odd_digits(int n)//defining a method sum_odd_digits

   {

       int sum=0,i;//defining integer variable

       for(i=0;i<=n;i++)//defining for loop

       {

           if(i%2!=0)//defining if block for odd number

           {

               sum=sum+i;//add odd number

           }

       }

      System.out.print(sum);//use print method to print sum value

   }

public static void main(String[] args) //defining main method

   {

       Scanner ox=new Scanner(System.in);//creating Scanner object

       int n= ox.nextInt();//defining integer variable for input value

       System.out.print(odd_number_digits(n)+ "\n");//use print method to call method

       System.out.println("Sum of odd numbers: ");//print message

       sum_odd_digits(n);//calling method

   }

}

Output:

please find the attachment.

Explanation:

In the above code, two methods "odd_number_digits and sum_odd_digits" are defined in which the first method return type is boolean because it will true or false value, and the second method returns the sum of odd numbers.

In the "odd_number_digits" method,  an integer variable passes as an argument and inside the method, if block is used that check value is a positive and odd number then it will return a true value.

In the "sum_odd_digits" method, it accepts an integer parameter "n", and define integer variable "sum" inside the method, which uses the for loop, inside the loop if block is used that counts odd numbers and adds its in sum and print its value.

Create A Boolean Function Odd_number_digits(n) That Returns True When A Positive Integer Has An Odd Number

Related Questions

Which example of IT lifelong learning is most likely to lead to a promotion

Answers

Answer:

A supervisor learns about personal finance.

Hope the above answer helps u...

If my answer helped u mark me as brainlist..!

Follow me...

Answer:

A supervisor learns about personal finance.

Explanation:

Which of the following statement about device formatting is FALSE?
A) Device manufacturers store the initial file-system data structures in the device.
B) Operating system can create multiple partitions with in a single device.
C) Volume creation is implicit when a file system is placed directly within a partition.
D) Not every partition contains a copy of the operating systems.

Answers

Answer:

The correct option is;

A) Device manufacturers store the initial file-system data structures in the device.

Explanation:

Before a storage device can be used for data storage, it is required to prepare the device for use and to make the device to become visible to the operating system by formatting of the device

New storage devices are not pre-formatted or come with a ready to use file system as there are different file systems specifically designed for particular  operating systems or operating environment.

Formatting creates partitions, makes the hard drive visible to the operating system and creates a file system that is new such that the storage device can be used for storing files.

A workstation’s user prefers KDE over GNOME. Which login manager can this user run to ensure direct login to KDE?
a. XDM
b. KDM
c. GDM
d. Any of the above

Answers

Answer:

B. KDM

Explanation:

The KDE display manager (KDM) was developed for the KDE desktop environment, while the GDM is a display manager for the gnome desktop environment.

The XDM display manager is used by the Linux operating system when a specific desktop environment is not chosen.

If you have a document that is relevant to more than one folder in your computer what should you do?

Answers

Answer:

save it to my docs

Explanation:

The person who Oversee the direct work of employees and is responsible for the day-to-day tasks the employees complete is likely

Answers

Answer: Operational Manager

Answer: operational manager

Explanation: APEX

Explain what a wiki is and list its advantages.

Answers

Explanation:

Wikis are defined as a form of a website or web page or a database where the users can work on the data, they can even add or edit the data. Wikis use a very quick as well as a easy syntax that allows the users to format the text and create various links between the pages. The users need internet browsers for that.

One of the main advantage of wiki is that it provides ability to collaborate asynchronously, and also without  time constraints.Besides it also provides a beneficial function of something. It is free and not expensive.

Write code that determines the number of full days represented by the number of hours stored in the variable hours and stores that value in the variable full_days. For example, the number of full days in 50 hours is 2. Ignore any leftover hours that don't contribute to a full day. Assume the value of hours has already been initialized. Solve It!

Answers

Answer:

hours = 50

full_days = int(hours / 24)

print("The number of full days in " + str(hours) + " hours is " + str(full_days))

Explanation:

Initialize the hours

Since there are 24 hours in a full day, divide the hours by 24. Note that you need to typecast it to the int, because the result is a decimal value by default

Print the values as requested

what are the earliest invention in human history​

Answers

Answer: Tools, Boats, Hand made bricks.

Explanation: The tools were the first technological advancement, the boats were the next, them hand made bricks for construction.

1605:newspapers
1608:telescope
1620:Compound microscope
1630:Slide rule
1642:mechanical calculator 1643:barometer
1650:vacuum pump
1656:pendulum clock

Hope this is enough

HELP FAST PLEASE!!! What is a glass tube containing electrodes used as a switch to produce on or off signals for the computer? First person to answer gets branliest. :3

Answers

Answer:

The answer is... Vaccum Tubes...

This is one which was used in computers before the Phenomenal invention of Transisitors.

A glass tube containing electrodes used as a switch to produce on or off signals for the computer is a Vacuum Tube.

What is a vacuum tube?

A vacuum tube is a tube that controls the transfer of electrons inside a tub. It is a valve. It is also called an electronic device used in television, amplifiers, radios, etc.

A vacuum tube contains a cathode and anode. The cathode is heated, and it emits or releases electrons. This emission is called thermionic emission. It controls the transfer of electrons, in a high-charge device. This is applied to the device where the electric potential difference is very high.

Vacuum tubes are used in old times, they are still used in some industries.

Thus, a vacuum tube is a glass tube with electrodes that serves as a switch to generate on or off signals for the computer.

To learn more about vacuum tubes, refer to the link:

https://brainly.com/question/14992264

#SPJ2

A network is:
A. A group of people or things that are individually connected to one another.
B. A number of individuals who share the same values and ideas.
C.a means of mass communication in print and other forms.
D. The main idea or information contained in a media piece.

Answers

Explanation:

The answer to this question is A

What term is used to describe an individual's money and personal property? budget income assets finances

Answers

Answer:

Pretty sure it's assests.

Explanation:

Income - Intake of money.

Budget - How much money you can spend.

Finances - Things you need to pay ort fund.

An asset is made up of the set of quantifiable goods and properties, which are owned by a person or a company.

What is an asset?

A right that has financial value is called an asset, which is a resource with value that someone owns.

Characteristics of an asset

The assets are recorded in the accounting balances, forming the credit.

The assets will receive a monetary value each, this valuation will depend on different criteria.

Therefore, we can conclude that the asset is the set of personal property, rights and other resources owned by a person.

Learn more about an asset here: https://brainly.com/question/16983188

1) You have a class called Sheep that wants to keep track of how many Sheep have ever been created. Where is a good place to put that variable? 2) When an h file mentions another class, what is that called? (When a cpp file needs to use a class, they include it. This is an h file just mentioning a class, like it has a pointer of that type. You are promising the compiler that the class is in another file.) 3) What is a good guideline for deciding you must write a copy constructor, an assignment operator, and a destructor? 4) void Rock::Func( const Rock & X){} What is that argument type called and what does it do? 5) We saw overloading the = sign. How do you declare a class wanting to override the parenthesis operator?

Answers

Answer:

The counter variable for the sheep count should be declared and initialized before the constructor in the class. The extern keyword should be used to declare the class in the receiving C source file. A constructor is defined when there is a need to instantiate an object with an argument and an assignment operator is used to initialize a variable. The const keyword is used to specify a variable whose value should not change during the course of the program execution.

Explanation:

The C programming language is an object-oriented programming language and has variable specifiers to define variable scopes in a program.

Egyptian hieroglyphs were part of a writing system used by the ancient Egyptians. What type of graphic design elements did they contain?

Answers

Answer:

Logographic, syllabic, and alphabetic elements. I think thts what u were asking for?

Explanation:

Many of the first photographers were actullay scientists and inventors

Answers

Answer:

True, if its a true or false. Otherwise I am of no help.

Explanation:

Answer:

True

Explanation:

When performing actions between your computer and one that is infected with a virus, which of the following offers No risk of your computer becoming infected?
A. Printing to the same printer as infected computer
B. Accepting email attachments sent from an infected computer
C. Sharing Word documents with an infected computer
D. Sharing removable disks with an infected computer

Answers

Answer:

d

Explanation:

The correct option is D: Sharing removable disks with an infected computer

Removable disks are disks that use to keep data as well transfer data or information from one computer to another computer.

With Removable disks a computer infected with a virus cannot infect another Computer as the what the user does is to simply insert  the USB port of the  Removable disks into the computer which inturn enable the transfer of data to the computer to take place .

Learn more about Removable disks here:

https://brainly.com/question/4327670

Which of the following is not true about templates?

It incorporates formatting elements.

They slow down the process of creating presentations.

It incoprorates layout options.

It may include content that can be modified.

Answers

The answer is they slow down the creating of presentations.

_______ tools enable people to connect and exchange ideas.
A) Affective computing.
B) Social media.
C) Debugging
D) Computer forensics.

Answers

Social media is a tool that enables people to connect and exchange ideas. Thus the correct option is B.

What is communication?

Communication is referred to the exchange of information between two individuals in the form of conversation, opinion, suggestion, or advice with the help of medium or direct interaction.

Social media is referred to as a tool of communication that enables people to share their ideas, thoughts, and opinions with a wide network of people and helps them to get information about the events happening in the world.

An internet tool for interaction, information sharing, and social networking is social media. Networking software that connects people around the world is an internet-based technology, strictly understood.

Therefore, option B is appropriate.

Learn more about Communication, here:

https://brainly.com/question/22558440

#SPJ5

Social media is a tool that enables people to connect and exchange ideas. Therefore, the correct answer is option B.

The exchange of information between two people in the form of conversation, opinion, suggestion, or advice with the use of a medium or direct interaction is referred to as communication.

Social media is referred to as a communication tool that enables individuals to communicate their thoughts, ideas, and opinions with a large network of people and assists them in learning about global events.

Social media is an online medium for communication, sharing of knowledge, and social networking. According to the definition of the term, internet-based technology includes networking software that links individuals worldwide.

Therefore, the correct answer is option B.

Learn more about communication here:

brainly.com/question/22558440

#SPJ6

Today technology is based in Science and engineering, earlier it was based on
__________ _____-_____.

Answers

Answer:

Technical know-how

Explanation:

Students who respond promptly to e-mails are following which netiquette rule?

A. keeping content appropriate
B. assessing an online environment
C. respecting everyone’s time
D. practicing ethical behaviors

Answers

Answer:

respecting everyone's time

Explanation:

they don't make people wait for a response

Its Option C - Respecting Everyone’s Time.
Thank you!

A coach wants to divide the basketball team into two groups for a practice game. Which statistical measurement is the coach most likely to use?
A) percentile
B) mean
C) median
D) mode

Answers

Answer:

median

Explanation:

Answer:

C) Median

Explanation:

The parameter passing mechanisn used in C is

Answers

Answer:

Hope you understand this answer

Pass by value is the answer

The __________ utility has the capability to manage users, create and administer user groups, and apply user rights to those users and groups. Active Directory Administrative Center Active Directory Domains and Trusts Active Directory Sites and Services Active Directory Users and Computers

Answers

Answer:

Active Directory Users and Computers

Explanation:

Active Directory Users and Computers is a term that describes Microsoft Management Console that is utilized in conducting and managing Active Directory, the objects; which comprises of the users and computers, the Organizational Units, together with their characteristics.

Hence, the Active Directory Users and Computers utility has the capability to manage users, create and administer user groups, and apply user rights to those users and groups.

How can you say that a computer is a versatile machine?​

Answers

Answer:

A computer is a versatile machine because is used for many purposes,a modern day computer can run multiple data at once making a fast and efficient machine very durable and effective for our use in all areas of life.

ethical issues of cyber bullying

Answers

Answer:

Explanation: As a student, I am aware of the existence of Cyber-bullying and the manner in which it can be carried out. I am also sensitive to the serious nature of the problem. However, I realise that I need to know more about the issue if I am to be effective in fostering a supportive learning environment in which students can grow as good digital citizens.

Cyber-bullying is similar to traditional psychological bullying in that-

There is an imbalance of power between the victim & perpetrator.

Victims draw negative attention & are isolated from their peer group.

Perpetrators are often encouraged & supported by their peer group.

The actions of the perpetrator are deliberate, repeated & relentless.

The negative attention is uninvited & unwanted by the victim.

The effects often cause depression, anxiety, low self-esteem, poorer mental & physical health and school avoidance.

Help me for this question

Answers

Answer:

Answer C

Explanation:

You are welcome

What do you think is the single greatest physical threat to information systems? Fire? Hurricanes? Sabotage? Terrorism? Something else? Discuss this question and provide support for your answer.

Answers

Answer:

The single greatest physical threat to information systems is:

Sabotage

Explanation:

Sabotage describes the efforts of internal persons to ensure that a system does not operate as intended or is destroyed.  Among the threats to information systems, this is the greatest.  The problem with sabotage is that the operators are internal, they know the system very well.  They understand the weak points and the strengths of the system.  They are internal terrorists to any information system.  These internal saboteurs are capable of using any means to achieve their purpose.  Therefore, it is necessary to scrutinize employees from time to time to discover internal risks.

People convicted of cyberbullying in most states
face no punishment for their actions.
face varying degrees of punishment.
are taught how to use technology positively.
are forced to do community service.

Answers

Answer: The Answer is B. face varying degrees of punishment.

Hope this helps! ^^ (also i know this is the right answer because i got it correct)

Answer:

b

Explanation: the punishment depends on the severeness , so we dont know the exact punishment

What is true about connectionless packet switched networks? a. each datagram must contain both source and destination addresses b. without a connection, datagrams may not arrive in sequential order at the destination c. establishment of a connection between communicating points is not required prior to exchanging datagrams, thus reducing overhead communications d. all of the above are true

Answers

Answer:

d. all of the above are true

Explanation:

Connectionless Packet Switching is a term that is used in computer networking operations to describe the breaking of information exchange path into a various packet of small sizes acquired and refined over network switches and routers, which is then transferred from one subsequent node to the other. It is sometimes referred to as Datagram Networks

However, during this operation, Connectionless Packet Switching must satisfy the following amongst others:

1.  each datagram must comprise both source and destination addresses

2.   without a connection, datagrams may not come in sequential order at the destination

3.  establishment of a connection between communicating points is not needed prior to exchanging datagrams, thus reducing overhead communications

Therefore, considering the available options, the correct answer is option D

The binary string 00100100 is a member of which of the following problems? Remember, a "problem" is a language whose strings represent the cases of a problem that have the answer "yes." In this question, you should assume that all languages are sets of binary strings interpreted as base-2 integers. The exception is the problem of finding palindromes, which are strings that are identical when reversed, like 00100100, regardless of their numerical value.

Answers

This question is incomplete, the complete question is;

The binary string 00100100 is a member of which of the following problems? Remember, a "problem" is a language whose strings represent the cases of a problem that have the answer "yes." In this question, you should assume that all languages are sets of binary strings interpreted as base-2 integers. The exception is the problem of finding palindromes, which are strings that are identical when reversed, like 00100100, regardless of their numerical value.

a) Is the given string a palindromes ?

b) Is the given string a perfect cube?

c) Is the given string greater than 50?

d) Is the given string even?

e) is the given string a perfect square?

Answer:

a) the given binary string is a palindromes

b) the given string is NOT a perfect cube

c) the given string is NOT greater than 50?

d) the given string is an even

e) the given string a perfect square

Explanation:

Given that;

binary string : 00100100

a)

Is the given string a palindromes ?

the given binary string = 00100100

now when you reverse the string, its still going to be : 00100100

so the given binary string is a palindromes

b)

Is the given string a perfect cube

the given string : 00100100 = 36

now 2^3 = 8,

3^3 = 27,

4^3 = 64

so 36 is not a perfect cubic

hence the given string is NOT a perfect cube

c)

Is the given string greater than 50?

the given string : 00100100 = 36

and 36 < 50

so the given string is NOT greater than 50?

d)

Is the given string even?

the given string  : 00100100 = 36

and 36 can be divided exactly by 2

so the given string is an even

e)

is the given string a perfect square?

the given string  : 00100100 = 36

now 6^2 = 36  i.e 6 multiply by 6 = 36

therefore the given string a perfect square

Clicking and double-clicking are two of the five

Answers

Answer:

The correct answer is events

Other Questions
which two models would be most useful in predicting weather what is your definition of science? **ANSWER AND ILL GIVE YOU BRAINLIEST ANSWER** Write an 12 line poem or more about 9-11 Organisms need _____ to conduct essential life activities If mPTQ = 3y 10 and mQTR = y, find the value of y so that PTR is a right angle 67000000 in scientific notation ____are compounds that produce H+ ions in solution. Glucose is a building block of carbohydrates. Which of these best describes glucose?A. nucleotideB. proteinC. monosaccharideD. lipid WILL MARK BRAINLIEST PLEASE HELP PLEASE HELP ASAPPPP!!!!! When they require their students to study classic literature, what do English teachers hope to show them? 4 1/3 times b = b = 6b + 10.4 Which statement gives two central ideas from the passage? A. Construction of the transcontinental railroad took many years, and the transcontinental railroad helped the Union Army win the Civil War. B. Construction of the transcontinental railroad was very challenging, and the transcontinental railroad was important to the growth of the United States. C. Construction of the transcontinental railroad was very dangerous, and the transcontinental railroad made the United States a more diverse nation. D. Construction of the transcontinental railroad led to the invention of track ballast, and the transcontinental railroad helped Utah become a state Which statement is incorrect concerning the formation of ionic compounds?a Halogens tend to form anions with a charge of -1.b. Alkali metals tend to form cations with a charge of +1.c. Metals tend to form cations, while nonmetals tend to form anions.d. Transition metals tend to form cations with a charge of +3.e. Noble gases tend not to form ionic compounds. Evan finds a rock. He scrapes it with his fingernail and leaves a scratch. His rock must be:O a metamorphic rockharder than feldsparsofter than diamondmade of more than one mineral HELLP Scale is... A. The system used by geographers to transfer locations from a globe to a map B. The extent of spread of. Aphenomenon over a give area. C. The difference in elevation between two points in an era. D. The relationship between length of an objects on a map and that feature on the landscape Determine the constant of proportionality, k, and interpret it in the context of each problem. 2) The graph shows the relationship between the number of euros Jason received and the number of dollars Jason exchanged during his trip to Spain. * An object example to decrease pressure. [tex]1.005 = 0.005x + 0.95[/tex] what is 8x+9x simplified completely {x|x is a living U.S. president born after 1700} How does the author of "Ethnic Hash", Patricia J. Williams, use rhetoric (effective or persuasive writing) to advance her point of view? *1 pointA. Williams begins with a playful tone but concludes with a cynical one that portrays disdain toward her convoluted ethnic identity.B. Williams uses irony throughout the article to communicate her feeling of displacement from the ethnic identity of the rest of the culture.C. Williams employs a humorous and often sarcastic tone to communicate the complexity of representing her composite ethnic identity in a single dish.D. Williams includes personal stories and vivid imagery to communicate her desire for an ethnic identity that both simplifies her heritage and disproves stereotypes