Input an int greater than 0 and print every multiple of 5 between it and 0 inclusive in descending order. If the number is not greater than 0 print "error". Print all numbers on one line with single spaces in between.
Example:
Enter a positive integer:
42
40 35 30 25 20 15 10 5 0

Answers

Answer 1

import java.util.Scanner;

public class JavaApplication42 {

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Enter a positive integer:");

       int num = scan.nextInt();

       if (num < 0){

           System.out.println("error");

       }

       else{

           while(num >=0){

               if (num %5 == 0){

                   System.out.print(num+" ");

               }

               num--;

           }

       }

   }

I hope this helps!

Answer 2

The program is an illustration of loops.

Loops are used to carry out repetition operations;

The program in Python, where comments are used to explain each line is as follows:

#This gets a positive integer from the user

num = int(input("Enter a positive integer: "))

#If the input is not greater than 0

if num <= 0:

   #This prints Error

   print("Error")

#If otherwise

else:

   #This iteration is repeated until 0 is printed

   while num>=0:

       #If the current number is a multiple of 5

       if num%5 == 0:

           #The number is printed

           print(num,end=" ")

       #This decreases the number by 1, until it gets to 0

       num-=1

The above program is implemented using a while loop

Read more about similar programs at:

https://brainly.com/question/20349503


Related Questions

X333: countElements Given an array of integers and an integer target, return a count of the number of times the target value occurs in the array. Examples: countElements((25, 42, 18, 25, 38, 96, 25, 25〉, 25) -> 4 countElements (110, 20, 30, 40, 50, 99)-> θ 1 public int countElements (int[] nums, int target) 2 {34 }5

Answers

Answer:

The method written in java is as follows:

public static int countElements(int[] nums, int target){

    int count=0;

    for(int i =0;i<nums.length;i++){

        if(nums[i] == target){

            count++;

        }

    }

    return count;

}

Explanation:

The method definition is not clear in the question you posted; so, I'll answer the question from scratch

This defines the method

public static int countElements(int[] nums, int target){

This initializes count to 0

    int count=0;

This iterates through the array

    for(int i =0;i<nums.length;i++){

This checks if the current array element is same as the target

        if(nums[i] == target){

If yes, the count variable is incremented by 1

            count++;

        }

    }

This returns the count

    return count;

}

See attachment for complete program which includes the main

g You and your friend both send documents to the printer, but the printer can only print one document at a time. What does it do with the other document

Answers

Answer:

It places the document in a buffer

Explanation:

Since the printer can only print a document at a time, the other document is going to be placed in a buffer.

The print buffer can be described as a location in memory that has the function of holding data that is going to be sent to a computers printer. A print job such as in this scenario may remain in the buffer because another document is to be printed first.

Sometimes a document could be put in the buffer because the computer is waiting for the printer to respond. This is just another reason why documents are placed in a buffer.

Write a Pandas program to import excel data (coalpublic2013.xlsx) into a dataframe and draw a bar plot where each bar will represent one of the top 10 production.

Answers

Answer:

import pandas as pd

import numpy as np

import matplotlib.pyplot as plt

df = pd.read_excel('coalpublic2013.xlsx')

sorted_by_production = df.sort_values(['Production'], ascending=False).head(10)

sorted_by_production['Production'].head(10).plot(kind="bar")

plt.show()

Explanation:

The python program plot a bar chart of the top ten productions in the excel worksheet. The excel file is read in as a pandas dataframe, sorted in descending order and the first ten of the dataframe is plotted as a bar plot.

Shrink-wrap, box-top, and click-wrap agreements are inherent to e-commerce. How you feel about them often depends on whether you are the vendor or purchaser. What are the best practices to assure shrink-wrap, box-top, and click-wrap agreements are legal? What are the best ethical practices that the e-commerce industry should adopt?

Answers

Answer:

Shrink-wrap, Box-top, and Click-wrap Agreements

a) The best practices to assure that shrink-wrap, box-top, and click-wrap agreements are legal include  

1) having e-commerce terms and conditions separate from the normal trade terms and conditions,  

2) ensuring that customers agree to the terms before entering into a transaction, and  

3) laying the code of conduct for all visitors interacting with your site or doing any business transaction on your site.

b) The best ethical practices that the e-commerce industry should adopt are:

1) Put additional layers of protection like a web application firewall to their websites.  

2) Ensure they always adhere to PCI (Payment Card Industry) compliance guidelines.

3) They should not store customers' data which they do not need.

4) Ensure privacy and security of customers' data.

5) Establish trust by safeguarding intellectual property rights.

6) Consider some environmental issues (customers care about them).

Explanation:

a) Websites' Terms and Conditions (T&C) establish some form of legal contract between the organization and its clients.  

b)To ensure that organizations that process, store, or transmit credit card information maintain secure online environment, they are required to comply with PCI DSS.  It is a set of Payment Card Industry requirements for all organizations involved in the use of online cards for payment for their goods and services.

Which input value causes the loop body to execute a 2nd time, thus outputting "In loop" again? { String s = "Go"; while ((!s.equals("q"))&& (!s.equals("")) System.out.println("In loop"); 5 - scnr.nextO;
a) "Quit"
b) "q" only
c) "Q only
d) Either "q" or "Q"

Answers

Answer:

a) "Quit"  

c) "Q only

Explanation:

Given

String s = "Go";

while ((!s.equals("q"))&& (!s.equals("")))  {

System.out.println("In loop");

s = scnr.next();

}

Required

What input causes another execution

Analyzing the while condition

while ((!s.equals("q"))&& (!s.equals("")))  

This can be split into:

!s.equals("q")) && (!s.equals(""))

Meaning

When s is not equal to "q" and when s is not an empty string

In other words,

the loop will be executed when user input is not "q" and user input is not empty.

So, from the list of given options: The loop both will be executed when:

a) Input is "Quit"

c) Input is Q only

Input of q will terminate the loop, hence b and d are incorrect

Define a function print_total_inches, with parameters num_feet and num_inches, that prints the total number of inches. Note: There are 12 inches in a foot.

Sample output with inputs: 5 8

Answers

I wrote my code in python 3.8:

def print_total_inches(num_feet, num_inches):

   return ((num_feet)*12) + num_inches

print("There are a total of {} inches".format(print_total_inches(5,8)))

I hope this helps!

Write the definition of a function that takes as input three numbers. The function returns true if the floor of the product of the first two numbers equals the floor of the third number; otherwise it returns false. (Assume that the three numbers are of type double.) (4)

Answers

Answer:

Written in C++

bool checkfloor(double num1, double num2, double num3) {

   if(floor(num1 * num2) == floor(num3)){

       return true;

   }

   else {

       return false;

   }

}

Explanation:

The function written in C++

This line defines the function

bool checkfloor(double num1, double num2, double num3) {

The following if condition checks if the floor of num1 * num2 equals num3

   if(floor(num1 * num2) == floor(num3)){

       return true; It returns true, if yes

   }

   else {

       return false; It returns false, if otherwise

   }

}

See attachment for full program including the main

Someone help me for about how to avoid online scams please I need help no trolls

Answers

Answer:

1. (for emails) Block spam messages.

2. Look at who sent whatever it is and make sure it is the exact email for the brand.

3. If someone is putting a lot of emojis in a comment or somthing its fake.

4. Make sure to read the fine print.

5. Do not giveaway personal information like zip code, address, social security number.

Using complete sentences post a detailed response to the following.

What are the advantages and disadvantages of top-down and bottom-up programming? How would you decide which one to use? Do you approach problems in your real life from a bottom-up or top-down approach?

Answers

Answer:

some advantages of top down is that you can start off from what you know and figure out what you need to complete it, advantages to bottom up is that you can make something new . if you are starting something from scratch and you dont know what the end goal might be you would use bottom up but if you already have an idea or the final product of what you want you would go the top down approach.

Explanation: just saying you shouldnt just copy and paste my response but rather pick out what you want to say and use this to complete what ever your working on. hope i helped :)

Answer:

the guy on top of me is super right follow him

Explanation:

There is no danger of data collision with this topology.

bus
mesh
ring
star

Answers

Answer:

ring

Explanation:

The Answer


C.Ring

This is evident beacause I am your advisor and I made that test so

if you make homemade knitted garments and you sell them to individuals online, what e-commerce are you participating in?
is it B2B or B2C or C2C or SaaS

Answers

The Answer Of This Question Is C2C.

a rectangle is 12 cm long and 9 cm wide.Its perimeter is doubled when each of its sides is increased by a fixed length.what is the length?​

Answers

Answer:

length = 12 cm

breadth = 9 cm.

perimeter of rectangle = 2( l+b)

= 2(12+9) = 2(21) = 42cm.

New length = (12+x) cm

New breath = (9+x) cm

2(12+x+9+x) = 42×2

2(21+x) = 84

21+ x = 84/2

21+x = 42

x= 42-21= 21

x= 21.

Therefore, length = (12+x)cm

=( 12+21) cm = 33cm.

Explanation:

Firstly we have written the length and breadth of the rectangle.

And the perimeter of rectangle i.e. 2(l+b)

Then, as it is in question we have doubled the perimeter

And at last, we have got the value of x.

and by putting the value in the new length we will get our answer.

hope you have got your answer dear.

This is my paragraph

. The type of color is ude in this code line is ..............................

Answers

What is the paragraph even supposed to be about

Write an expression that prints 'You must be rich!' if the variables young and famous are both True.
young = True
famous = False
if ''' Your solution goes here ''':
print('You must be rich!')
else:
print('There is always the lottery...')
Python 3 language

Answers

Answer:

Following are the expression to this question:

if (young and famous==True):

Explanation:

For print, the given expression the code requires some modification that can be defined as follows:

young = True#defining a bool variable that holds a value True

famous = True#defining a bool variable that holds a value True

if (young and famous==True):#defining if block that check variable value

   print('You must be rich!')#print message

else:#else block  

   print('There is always the lottery...')#print message

Output:

You must be rich!

Code explanation:

In the above-given code, two variable "young and famous" is declared, that hold a "True" which is a bool value, in this code, a conditional statement has used, that checks variable value, which can be defined as follows:

In the if block, it uses the above declared variable with and gate to check its value is equal to true. If the condition is true, it will print the true block message, otherwise, go to the else block in this, it will print the else block message.

Type the correct answer in the box. Spell the word correctly.
Under which menu option of a word processing program does a star appear?
A star appears under the
menu of the word processing program.
Reset
Next

Answers

Answer:

"a callout is a type of text box that also includes a line for pointing to any location on the document. A callout appears under the SHAPES menu of the word processing program. The answer that completes this statement is the word "shapes". Hope this answers your question."

Explanation:

The correct answer in the box is as follows:

A star appears under the shapes menu of the word processing program.

What is the word processing program?

The word processing program may be characterized as a type of MS software that is significantly used to create, edit, save, and print documents on a computer. It permits a user to create documents that mimic the format and style of the original document along with diverse functions.

The Shapes menu in the word processing program has numerous shapes like rectangles, Ellipses, and Freehand polygons. There are some other numbers of other shapes such as arrows, speech balloons, various stars, and others are also included in this menu tool.

If a user wants to add any specific shape, he/she is allowed to click Insert, click Shapes, select a shape, and then click and drag to draw the shape. That specific shape is now inserted in the word processing documents.

Therefore, a star appears under the shapes menu of the word processing program.

To learn more about Word processing documents, refer to the link:

https://brainly.com/question/1596648

#SPJ7

PLzzzzzz help me!! I will mark brainiest to the one who answers it right!!
Answer it quickly!!

Write a pseudo code for an algorithm to center a title in a word processor.

Answers

Answer: abstract algebra

Explanation: start with the algorithm you are using, and phrase it using words that are easily transcribed into computer instructions.

Indent when you are enclosing instructions within a loop or a conditional clause. ...

Avoid words associated with a certain kind of computer language.

Answer:

(Answers may vary.)

Open the document using word processing software.

In the document, select the title that you want to center. The selected word is highlighted.

On the Menu bar, select the Format tab.

In the Format menu, select Paragraph.

The Paragraph dialog box opens with two sub tabs: Indents and Spacing, and Page and Line Breaks. The first tab is selected by default.

Adjust the indentation for the left and right side. Ensure that both sides are equal.

Preview the change at the bottom of the dialog box.

Click OK if correct, otherwise click Cancel to undo changes.

If you clicked OK, the title is now centered.

If you clicked Cancel, the title will remain as it is.

Explanation:

I took the unit activity

The ball in the program was an instance of a sphere.

Which quantity do you change to move the ball?

vector

pos

radius

axis

Answers

Answer:

axis

Explanation:

i hop is correct don geve my 5 start in to is conform

Answer:

Pos

Explanation:

Edge2020

Write a script that inputs a line of plaintext and a distance value and outputs an encrypted text using a Caesar cipher.
The script should work for any printable characters. An example of the program input and output is shown below:
Enter a message: Hello world!
Enter the distance value: 4
Output: Lipps${svph%

Answers

Answer:

def encrypt_text(text,value):

   encoded = ""

   for i in range(len(text)):

       char = text[i]

       if (char.isupper()):

           encoded += chr"po"ord'po'char'pc' + value -65'pc' % 26 + 65'pc'

       else:

           encoded += chr'po'ord'po'char'pc' + value -97'pc' % 26 + 97'pc'

   return encoded

plaintext = input("Enter sentence of encrypt: ")

dist_value = int(input("Enter number: "))

encrypted = encrypt_text(plaintext, dist_value)

print(encrypted)

Explanation:

The python program above is a Ceasar cipher implementation. The encrypt_text function is defined to accept text input and a distance value, which is used to encrypt the plaintext.

The user can directly input text and the distance value from the prompt and get the encrypted text printed on the screen.

Why would an information systems security practitioner want to see network traffic on both internal and external network traffic?

Answers

Answer:

To see who is accessing data and also where it is going

Explanation:

An information systems practitioner is a person who is involved in the planning and and also implementation of IT resources for any organization which he at she works.

The information systems practitioner would want to want to see network traffic on both internal and external network traffic so as to know who is accessing data and to also know where it is going.

Write a method called rotate that moves the value at the front of a list of integers to the end of the list. For example, if a variable called list stores the values [8, 23, 19, 7, 45, 98, 102, 4], then the call of list.rotate(); should move the value 8 from the front of the list to the back of the list, changing the list to store [23, 19, 7, 45, 98, 102, 4, 8]. If the method is called for a list of 0 elements or 1 element, it should have no effect on the list. You may neither construct any new nodes to solve this problem nor change any of the data values stored in the nodes. You must solve the problem by rearranging the links of the list.

Answers

Answer:

Explanation:

public void rotate()

{

if(front == null)

return;

ListNode current = front;

ListNode firstNode = current;

while(current.next != null)

{

current = current.next;

}

current.next = front;

front = firstNode.next;

firstNode.next = null;

}

Who wants to play nitro type with me. My user is thievesGuildcuu

Answers

Answer:

I can

Explanation:

Answer:

Sure.

My user Name is: Queen Void.

Write function that ask for input from a user. Use this input as input for the countdown function that we wrote using the while loop. If the user types 'end', the program exits, otherwise it keeps going.

Answers

Answer:

Written in Python:

def myfunction():

     userinput = input("User input: ")

     while(userinput != "end"):

           countdown(userinput)

           userinput = input("User input: ")

Explanation:

This line defines the function

def myfunction():

           This line prompts user for user input

           userinput = input("User input: ")

           The following while loop checks if userinput is not "end". It continues execution until user input "end"

           while(userinput != "end"):

                       countdown(userinput) If yes, the input is passed to the countdown function for execution

                       This line prompts user for another user input

                       userinput = input("User input: ")

Please note the above code segment assumes that countdown() function has already been written and defined

20 pts, please write in JAVA. need this ASAP
In the Lesson Slides for this activity, we developed a method findChar for figuring out if a character was in a String.

The implementation was:

public boolean findChar(String string, String key)
{
for(int index = 0; index < string.length(); index++)
{
String character = string.substring(index,index+1);
if(character.equals(key))
{
return true;
}
}
return false;
}
However, there is a much more efficient and simple algorithm that we can use to determine if a character is in a String. Using the method signature public boolean findChar(String string, String key), figure out a more efficient method with a lower exection count.

Hint: We’ve learned a couple of methods that can tell us what index a character is at - can we use those to determine if the character is in a String?

Answers

public class JavaApplication78 {

   public boolean findChar(String string, String key){

       if (string.contains(key)){

           return true;

       }

      return false;

   }

   public static void main(String[] args) {

       JavaApplication78 java = new JavaApplication78();

       System.out.println(java.findChar("hello", "h"));

   }

   

}

First I created the findChar method using the contains method. It checks to see if a certain sequence of characters is in another string. We returned the result. In our main method, we had to create a new instance of our main class so we could call our findChar method.

Write a logical expression using only and, or and not that is equivalent to the Exclusive NOR (XNOR) gate on 2 inputs, called in1, in2: If both inputs are True or both inputs are False (i.e. inputs have same value), then your expression should evaluate to True. Otherwise your expression should evaluate to False.

Answers

Answer:

in1 = int(input("Enter value one: "))

in2 = int(input("Enter value two: "))

print(in1,type(in1), in2, type(in2))

if (in1 <=0 and in2 <=0) or (not in1 <=0 and not in2<=0):

   print( True)

else:

   print( False)

Explanation:

The if statement of the python source code is used to implement an Exclusive-NOR logic gate that gives a true or high value if both inputs are either true or false.

Which term describes a visual object such as a picture a table or text box

Answers

the correct answer is “caption”

Answer: caption

Explanation:

Edge 2020

Which statistical measurement tools should be
used to solve the problem? Check all of the boxes
that apply.
A coach wants to calculate the average test scores
of students who participate in the most popular
sport that the school offers.
mean
median
mode

Answers

Answer:

mean

mode

Explanation:

edg 2020

Answer:

MEAN

mode

Explanation:

Create a new program with a struct, Data, that contains: an int a char[80] Write a function newData(char[]), that takes char[] as a parameter

Answers

Answer:

#include <iostream>

#include <cstring>

using namespace std;

struct Data {

   int userId;

   char name[80];

}

void newData(string data char[]){

   int counts= 0;

   struct Data name;

   data.userId = ++counts;

   data.name = char[];

   cout<< data.userId << "\n"<< data.name ;

}

int main( ) {

   char myName;

   string mydata;

   cin>> myName;

   cin>> mydata;

   newData( myName, mydata);

}

Explanation:

The c++ source code above stores its data in a struct called "Data". The function newData dynamically creates new data from the struct defined.

Because all the IEEE WLAN features are isolated in the PHY and ____________ layers, practically any LAN application will run on a WLAN without any modification.

Answers

Answer:

MAC

Explanation:

MAC Layer is the acronym for Media Access Control Layer. This said Media Access Control Layer happens to be one of the two sublayers that comprises of the Data Link Layer of the OSI model. The Media Access Control layer is majorly responsible or in charge of moving various data packets to the Network Interface Card, and also from the Network Interface Card (NIC) across a particular shared channel. The Media Access Control sublayer and the logical link control sublayer together are what makes up the data link layer.

how has the Internet of Things affected business​

Answers

Internet of Things devices can be connected to each other and controlled to improve efficiency,which in turn has direct effects on the productivity of the business. Hope this helps!

Answer:

Business equipment can be continually adjusted based on analysis of data

Explanation:

A P E X

Help me! I’ll mark you brainly ! Please help me I need this now

Answers

Explanation: For number 3 I would say shade and darkness.

Other Questions
Five british soldiers were killed in the boston massacre. true or false Which of these best describes the change in population of a country wherethe total fertility rate exceeds the replacement fertility rate, withoutconsidering immigration rate, emigration rate, or death rate? How many milliliters of water would be needed to fill a one liter glass jar?10010,0001,00010 A current of 15 Amps flows through a circuit with a resistance of 0.10 Ohms. What is the voltage?A. 0.006 VoltsOB. 1.5 VoltsO C. 15 VoltsD. 150 Volts Piedras was forced to surrender to the Texans because A. He lost the battle of Velasco. B. His soldiers ran out of ammunition. C. His men turned against him. D his forces were outnumbered Do you believe that Louis XVI should have been beheaded? Explain. Use the diagram to answer the question. Between which parts of the molecule must the bonds be broken to form an ADP molecule? What is the amount of work required to increase a 1100 kg car's speed from 20.0 m/s to 50.0 m/s? when dividing 592 by 9.25, how many zeros will be placed in the dividend?A: oneB: twoC: threeD: four What were Quakers noted for?A. Their violent anti-slavery protestsB. Their strong support of slaveryC. Their inability to express a clear position on slaveryD. Their strong leadership in the abolitionist movement Help me please ASAP!! can sum1 do this for me i honestly don't want to What are the main theories for why the Kingdom of Kush collapsed? Choose three correct answers.The Kingdom of Kush may have collapsed because of disease.Invaders may have destroyed the Kingdom of Kush.The Kingdom of Kush may have collapsed because of poor leadership.The Kingdom of Kush may have destroyed its own resources.Environmental damage from smelting may have affected crops. What two tribes caused challenges for Spanish missionaries in the Plains region? aKarankawas & Apaches bApaches & Comanches cJumanos & Comanches dCaddoes & Jumanos Which group of workers was most negatively affected by the increasing useof machines?A. Skilled workersB. Unskilled workersC. ManagersD. Owners Translate I want to see my book into Spanish What is greater 18/14 or 1 2/7 Geometry help plz who ever gets correct will get brainlist promise! El dueno de la casa _____ de las llaves y entramos al departamento add two fractions please 2/5+1/4