WILL GIVE BRAINLIEST, JAVA PROGRAMMING PLS HELP
Here is the prompt:
The code provided is intended to use a while loop to print the first 9 multiples of an integer entered by the user. For example if the user enters 5, the program should print the numbers 5, 10, 15.,... up to 45, one per line. Debug the code so it functions as described.
Here is the code:
Scanner scan = new Scanner(System.in);
int num = scan.nextInt();
int fac = 1;
while(fac < 9){
System.out.println(num*fac);
fac++;
System.out.println(num*fac);
}

}
}

Answers

Answer 1

Answer:

import java.util.Scanner;

public class Main {

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       int num = scan.nextInt();

       int fac = 1;

       while(fac <= 9){

           System.out.println(num*fac);

           fac++;

       }  

   }

}

Explanation:

Hello, I tried out your program, and I just wanted to point out some little issues :)

You need to import the java.util.Scanner in order to use Scanners :)

Also, (not sure if you just didn't copy the stuff at the start) but you need the public class and the public static void main.

Last of all, since you're printing out all of the first 9 multiples, the 9th is included, so you use <= instead of <.

I have sent you the right code above ^^ :)

Please mark brainliest if this has helped you.

Answer 2

Debugging a code involves locating and fixing the errors/bugs in the code.

The error in the code is that, the following print statement is repeated twice

System.out.println(num*fac);

The correction is to remove the first appearance of

System.out.println(num*fac);

So, the corrected code is as follows

Scanner scan = new Scanner(System.in);

int num = scan.nextInt();

int fac = 1;

while(fac < 9){

System.out.println(num*fac);

fac++;

}

Read more about debugging at:

https://brainly.com/question/23527739


Related Questions

100 POINTS PLEASE HELP Ken Thompson and Dennis Ritchie co-created which operating system?

Answers

Answer:

UNIX operating system

Explanation:

Unix is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, development starting in the 1970s at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and others.

Answer:

the UNIX

During the 1960s to 1970s, Bell Labs colleagues Ken Thompson and Dennis Ritchie developed UNIX, a multi-tasking, multi-user operating system alternative to the batch processing systems then dominating the computer industry.

Explanation:

Identify the common features of software applications. (choose all that apply)
a pointer
toolbars
an operating system
buttons
hardware
a mouse

Answers

Answer:

a pointer, toolbars and buttons

Explanation:

got it correct

Answer:

Pointer, toolbars, and buttons

Explanation:

Will creates an entry in his calendar and marks it as an all-day instance. Which item has he created?
Appointment
Meeting
Event
Period

Answers

Answer:

The answer u looking for is event

Answer:

event

Explanation:

Type the correct answer in the box.
How can users prevent broadcasting their existing connections?
User can make the BLANK name invisible, thereby preventing the hackers from knowing about an existing connection.

Answers

Answer:

User can make the network name

Answer:

The correct answer is: SSID

Explanation:

Hiding the SSID involves preventing the broadcast of the SSID name. Users can make the SSID name invisible to prevent hackers from knowing about an existing connection.

Edhesive 3.2 code Practice:Question 1

Write a program to a number and test if it is greater than 45.6. If the number entered is greater than 45.6, the program needs to output the phrase “Greater than 45.6.

Sample Run
Enter a number:90

Sample output
Greater than 45.6

Answers

Answer:

a = float(input("Enter a number: "))

if(a > 45.6):

   print("Greater than 45.6")

Explanation:Code is in Python.

The program is an illustration of conditional statements.

Conditional statements are used to execute statements depending on the truth value of the condition.

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

#This gets input for the number

num = float(input("Enter a number:"))

#This checks if the number is greater than 45.6

if num > 45.6:

   #If yes, the appropriate text is printed

   print("Greater than 45.6")

#If otherwise, the program is exited

Only numbers greater than 45.6 will cause the statement in the condition to be executed.

See attachment for sample run

Read more about similar programs at:

https://brainly.com/question/19123086

Which sentences describe the value of a conditional statement? Check all that apply.

It allows a programmer to designate a portion of the code that will be run only when a condition is met.

It creates new program code when a condition is met.

It allows a programmer to set a condition that must be met.

It incorporates decision-making into a program.

Answers

Answer:

134

Explanation:

Edgenuity

Answer:

1. It allows a programmer to designate a portion of the code that will be run only when a condition is met.

3. It allows a programmer to set a condition that must be met.

4. It incorporates decision-making into a  program.

Explanation:

For your biology class, you have taken a number of measurements for a plant growth experiment. You wish to create a chart that shows what the progress looks like over time. Which application is best suited for this effort?


Notepad or Paint


Impress or PowerPoint


Writer or Word


Calc or Excel

Answers

Calc or excel
Hope this helps

2.4 Code Practice: Question 1

Write the code to input a number and print the square root. Use the absolute value function to make sure that if the user enters a negative number, the program does not crash.

Answers

Answer:

num = float(input("Enter a number : "))

ab = abs(num)

sqrt = float(ab ** 0.5)

print(sqrt)

Explanation:

Can anyone please help me with how to use a while loop to ask a user to input positive integers until the user enters 0 and at the
end, print the largest number of all the integers entered.

I can send an example if needed

Answers

In python 3:

def main():

   largest = 0

   while True:

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

       if number == 0:

           print(largest)

           return

       elif number > largest:

           largest = number

if __name__ == "__main__":

   main()

I hope this helps!

True or false
A compiler translates a source program one line of code at a time.

Answers

Answer:

True

Explanation:

yes It translates one line at a time to be able to confirm all information.

Answer:

True

Explanation:

I hope this helps you

Question 12 (1 point)
Generally, each pixel in an image creates 25 bytes of data.
True
False

Answers

Answer:

This is B: False

Explanation:

Each pixel of an image creates 24 bits, or 3 BYTES of data for color, and 1 byte for black and white.

PLZ BEEN STUCK ON THIS



What is the second software layer of the Open Systems Interconnection reference model called?

data link
protocol
network
TCP/IP

Answers

Answer:

am not really sure but between TCP/IP and data link am sorry for not being precise .

Answer: DATA LINK

Explanation:

SEARCH IT UP!

Please help, this question is from plato.
What is HTML?
A.
a language
B.
a software application
C.
a website
D.
a browser
E.
a malware program

Answers

Answer:

A

Explanation:

It is a programming language.

Answer:

A

a. language

Explanation: i took the test and hope this help have a good day.

Vincent is a digital media professional. His bosses always praise his artwork. His company has just taken on a new project. Vincent has some thoughts and ideas about this new project that he wants to discuss with the senior employees. What kind of skills should he use to pitch his ideas?
A.
technical
B.
manipulative
C.
social
D.
interpersonal

Answers

Answer:

A

Explanation:

I think the answer in A

When would you use the Reading View in Word?

To add an image to the document
To have Word Online read the document to you
To make changes to the document
To read the document without any distractions

Answers

Answer:

D: to read the document without any distractions

To read the document without any distractions is used in the reading View in Word. Thus, option D is correct.

What is an Inference?

This refers to the deductions or conclusions that are made about a particular thing or idea based on available evidence, background information and powers of conclusion.

Hence, we can see that from the given text, Nicholas Carr is quoted as saying that reading online makes people to be 'mere decoders of information.' and this makes people become less engaged as they tend not to use their ability to interpret texts less and less.

Based on the given text, it can be seen that Nicholas Carr believes that reading online makes people not connect as deeply as reading without distraction, which can be an inference, to offline reading.

Therefore, To read the document without any distractions is used in the reading View in Word. Thus, option D is correct.

Learn more about document on:

https://brainly.com/question/27396650

#SPJ2

what are the 2 things you are not sure about evaluating functions​

Answers

Answer:

every thing

Explanation:

Answer:

To evaluate a function, substitute the input (the given number or expression) for the function's variable (place holder, x). Replace the x with the number or expression. 1. Given the function f (x) = 3x - 5, find f (4).

A function is a relation in which each input has only one output. In the relation , y is a function of x, because for each input x (1, 2, 3, or 0), there is only one output y. x is not a function of y, because the input y = 3 has multiple outputs: x = 1 and x = 2.

A formula is an expression which calculates the value of a cell. Functions are predefined formulas and are already available in Excel. For example, cell A3 below contains a formula which adds the value of cell A2 to the value of cell A1.

Explanation:


3. Which of the following is used as a container to keep salted fish during the
process?
a. bistay
b. oil drum
c. mixing bowl
d.earthen pots​

Answers

Answer:

A. yes A is actually used as a container to keep salted fish

Explanation:

plzzzzzzzzzzzzz give me brainiest

Consider the following code:
Using Python
x = 19
y = 5
print (x % y)
What is output?

Answers

In python the % operator is modulo. Modulo returns the remainder of two numbers.

19 % 5 = 4 therefore,

print(x%y) would output 4

Using Python, the output of the code will be 4. The explanation of the problem is shown below.

What is Python?

Python is a high-level, interpreted programming language that was first released in 1991 by Guido van Rossum. It is a general-purpose language that can be used for a wide variety of applications, including web development, scientific computing, data analysis, artificial intelligence, machine learning, and more.

Python is known for its simplicity and readability, making it easy to learn and use. Its syntax is designed to be concise and expressive.The % operator in Python returns the remainder of the division of two numbers.

In this case, x % y is equivalent to 19 % 5, which is 4 since 19 divided by 5 is 3 with a remainder of 4. The print function is used to display the value of the expression x % y on the screen.

Learn more about Python, here:

https://brainly.com/question/30391554

#SPJ3

Write an algorithm in pseudo code to find the product of two numbers​

Answers

Answer:

Read num1 , num2

Set multi to num1*num2

Write multi

Explanation:

Accurately describing the message in the subject line makes it more likely that the message will be read.
True
False

Answers

the sentence is true

True
I think is true

Question 3 :The easiest way to become a victim of malware, spyware or viruses is through:This task contains the radio buttons and checkboxes for options. The shortcut keys to perform this task are A to H and alt+1 to alt+9.
A

texting.
B

online chatrooms.
C

playing games.
D

downloads.

Answers

Answer:

downloads.

Explanation:

A test using various ransomware strains showed that 1,000 Word documents could be encrypted in anything from 18 seconds to 16 minutes.  Thus, option D is correct.

What easiest way to become a victim of malware download?

Phishing emails are by far the most popular way for hackers and state-sponsored hacking groups to disseminate malware.

Adware is malware that targets computer users with unwanted adverts. This makes it possible for the creator of the malware to obtain payment from the companies whose adverts are served by it.

However, certain viruses may be scheduled to begin infecting your computer a few days after they are downloaded. Other viruses may attempt to circumvent antivirus protection by downloading in chunks.

Therefore, Hackers have become adept at crafting emails that lead recipients to click on links or download files that contain malicious software.

Learn more about downloads here:

https://brainly.com/question/29328797

#SPJ2

Question # 4
Multiple Choice
Which number is equivalent to 72.5e-2?
O 72.5
O 7.25
0 7250
O 0.725

Answers

answer is

o

that's so easy

Answer:

0.725

Explanation:

72.5e-2 = 72.5 x 10-2 = 0.725

A customer complains that the network connection on the laptop is intermittent. The customer states that they are using a wireless PC card for network connectivity. The customer believes that the laptop may be too far from the wireless access point; however, he does not know where the wireless access point is located.

As a technician, you need to be able to ask questions that will be recorded on a work order. What are 5 closed-ended questions and 5 opened-ended questions that you would ask a customer. ​

Answers

how are you

I will ask what's the problem

what happend before u saw this

what did I do after

was anyone with you

and give me permission to help

Help please I’ll give u brainless

Answers

c its c OK your welcome

Steve Jobs described early computers as “the most remarkable tool that we’ve ever come up with..it’s equivalent of a bicycle for our minds.” Would you describe smartphones as a bicycle for our minds?

Answers

Answer:

Here is my stance on the phone issue and a quote from Steve himself.

"I think one of the things that really separates us from the high primates is that we’re tool builders. I read a study that measured the efficiency of locomotion for various species on the planet. The condor used the least energy to move a kilometer. And, humans came in with a rather unimpressive showing, about a third of the way down the list. It was not too proud a showing for the crown of creation. So, that didn’t look so good. But, then somebody at Scientific American had the insight to test the efficiency of locomotion for a man on a bicycle. And, a man on a bicycle, a human on a bicycle, blew the condor away, completely off the top of the charts.

And that’s what a computer is to me. What a computer is to me is it’s the most remarkable tool that we’ve ever come up with, and it’s the equivalent of a bicycle for our minds."

Explanation:

Like anything smartphones, computers, and television can be the junk-food equivalent of our minds or the inspiration to better yourself with knowledge and creativity. To me its like a bicycle in that are you riding the bicycle to healthfoods or mcdonalds. Its the freedom of the transportation of knowledge that can be so life-changing and so life-threating at the same time.

I would not think of smartphones as a bicycle for our minds as they do not run on how my mind functions.

What are people view on the quote above?

Some people do believe that the statement is true. They think also that smartphones and tablets can be a source of big distraction if not handled well.

Smartphones are a good learning tools, or they can be bicycles for our minds only when they are used by a skillful person.

Learn more about smartphones from

https://brainly.com/question/917245

4.1 Code Practice: Edhesive

Answers

In python 3:

while True:

   name = input("Please enter a name: (Nope to end) ")

   if name == "Nope":

       break

   print("Nice to meet you {}".format(name))

I hope this helps!

   

The program is an illustration of while loops.

While loops are used to perform iterative operations, until the condition is met

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

#This prompts the user for name

name = input("Please enter a name (Nope to end) ")

#This checks if input is "Nope"

while name.lower()!="nope":

   #If no, this prints the greetings

   print("Nice to meet you",name)

   #This prompts the user for another input

   name = input("Please enter a name (Nope to end) ")

Note that the loop is repeated until the user enters "Nope" or "nope"

Read more about while loops at:

https://brainly.com/question/18430675

For your biology class, you will be giving a presentation of the findings of a plant growth experiment. Which application is best suited for this presentation?


Writer or Word


Impress or PowerPoint


Notepad or Paint


Calc or Excel

Answers

Answer: Powerpoint

Explanation: Easy to give graphs and add pictures. You can also add shapes to create a bar graph if needed.

Answer:

Calc or Excel

Explanation:

4.2 Code Practice: Question 1

Write a program that inputs numbers and keeps a running sum. When the sum is greater than 100, output the sum as well as the count of how many numbers were entered.

Sample Run

Enter a number: 1
Enter a number: 41
Enter a number: 36
Enter a number: 25

Sum: 103
Numbers Entered: 4

Hint: If you get an EOF error while running the code you've written, this error likely means you're asking for too many inputs from the user.

Answers

In python:

total = 0

i = 0

while total <= 100:

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

   i += 1

   total += number

print("Sum: {}".format(total))

print("Numbers Entered: {}".format(i))

I hope this helps!

how can we show that heat is liberated during respiration​

Answers

Answer:

To show that heat is liberated during respiration. Make a hole in the cork and insert a thermometer into cork and see the bulb of the thermometer is in the midst of the seeds. Record the temperature in both the flasks at every two or three hour intervals for about 24 hours.

Explanation:

Hope this helps:)

Which of the following would be provided from the use of a GIS?

a. map displaying satellite data of farmland use
b. map displaying projected path of a hurricane
c. Doppler radar images for weather forecasting
d. satellite images used to reconstruct a forest fire

Answers

Itsssssssssssssssssssssssss B

The one that would be provided from the use of a GIS is a map displaying the projected path of a hurricane. The correct option is b.

What is GIS?

A computer system that analyzes and presents spatially related data is known as a Geographic Information System (GIS). It makes use of information associated with a certain place.

People can use GIS technology to compare the locations of various objects to determine how they connect to one another. For instance, utilizing GIS, a single map might show both polluting and pollutant-sensitive locations, such as wetlands and rivers, as well as locations that cause pollution, such as industries.

You need to enable tropical storm tracking if you want to follow a hurricane on our map. Click the symbol in the top-right corner to begin.

Therefore, the correct option is b. map displaying the projected path of a hurricane.

To learn more about GIS, refer to the link:

https://brainly.com/question/14464737

#SPJ2

Other Questions
HURRY ILL GIVE 10 BRAINLY POINTSWhat is 1 times 300 Explain the evolution of the role and goals of the Dawes Commission. 10. The first Texans begin to practice _________ when they planted seeds to grow their own food. Consider this situation: A force is applied to a box to move itto the right across the kitchen floor. Of the forces listed,identify which act upon the box. what is the main idea of sunday at the water park Direct Object Pronoun Practice: Rewrite each of the following sentences by replacing the direct object noun with the appropriate pronoun.1. Yo necesito los boletos. _________________________________________________________2. Mi hermano no tiene su pasaporte. _________________________________________________3. La agente confirma el vuelo. ______________________________________________________4. Yo quiero comprar unos trajes de bao. _____________________________________________5. Ella prefiere facturar el equipaje. __________________________________________________ this is the portion of the electromagnetic spectrum that has a frequency just below the visible spectrum. (For number 8, the one that is highlighted.) which of the following is not a reason for the european exploration in the 15th and 16th century? Plot Structure Questions5 questions1The main problem that moves the plot along is:A slope = -1/6; (12, -2) ILL MARK YOU AS BRAINLIEST, PLEASE HELP!!! What is the best thing to do if I'm beginning to play the guitar? Assume Brad has a choice between two deposit accounts. Account WH has an annual percentage rate of 7.35% with interest compounded continuously. Account MW has an annual percentage rate of 7.45% with interest compounded monthly. Which account provides the highest effective annual return? George Michael anyone? WILL NAME BRAINLIST! True or false: Monsters has souls *50 pointsTrueFalse Read the excerpt from Fourteen by Alice Gerstenberg. Which part of the plot structure does the excerpt represent? ""Mr. Farnsworth?"" sneered Mrs. Pringle. ""Its the Prince of Wales that we will turn our attention to now. Who knew a blizzard could be such a wonderful thing!"" A. exposition B. resolution C. rising action D. climax A 3-yard roll of butcher paper costs $8.55. What is the price per foot? A major component of gasoline is octane (C8H18). When octane is burned in air, it chemically reacts with oxygen gas (O2) to produce carbon dioxide CO2 and water H2O. What mass of carbon dioxide is produced by the reaction of 7.58 g of octane? Please explain the answer to me like I'm five, I want to understand but the content makes no sense. How do you solve this problem ? PLSSS HELP ITS URGENT ILL RATE YOU BRAINLIEST:) A truck whose bed is 4 m long, 2.2 m wide, and 1.0 m high is delivering sand for a sand-sculpture competition. About how many trips must the truck make to deliver 23 m^3 of sand?