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
son4ous [18]
3 years ago
10

Find prime no using Java

Computers and Technology
1 answer:
bonufazy [111]3 years ago
4 0

Answer:

Um

Explanation:

I don't understand

You might be interested in
Use JavaWrite a program that will simulate a change machine found at cash registers. Input the amount due and amount paid from t
Ksju [112]

Answer:

Here is the JAVA program:

import java.util.Scanner;  //to accept input from user

public class Main { // class name

 public static void main(String [] args) {  // start of main method

   Scanner input = new Scanner(System.in);  // creates Scanner class object to take input from user

   System.out.println("Please Enter the Cost of the Item: ");  // prompts user to enter the cost of item

   double itemCost = input.nextDouble();  //scans and reads the input value of item cost

   System.out.println("Please Enter the Amount Paid: ");  // prompts user to enter the amount paid

   double amount = input.nextDouble();  //scans and reads the value of amount from user

   int change = (int)(amount * 100 - itemCost * 100);  //compute the remaining amount i.e. change

   System.out.println("Change Owed: " + change / 100.0);  // displays the owed change

   int quarters = change / 25;  // computes the value for quarters

   change = change % 25;  // compute the quarters remaining

   int dimes = change / 10;  //  computes dimes

   change = change % 10;  //  computes dimes remaining

   int nickels = change / 5;  // computes nickels

   change = change % 5;  // compute nickels remaining

   int pennies = change;  // computes pennies

   System.out.println("Quarters: " + quarters);  // displays computed value of quarters

   System.out.println("Dimes: " + dimes);  // displays value of dimes

   System.out.println("Nickels: " + nickels);  // displays value of nickels

   System.out.println("Pennies: " + pennies);   }} //displays value of pennies

Explanation:

I will explain the program with an examples.

Suppose the user enters 4.57 as cost of the item and 5.00 as amount paid. Then the program works as follows:

Change is computed as

change = (int)(amount * 100 - itemCost * 100);

This becomes;

change = (int)(5.00 * 100 - 4.57 * 100)

            = 500 - 457

change = 43

Now the change owed is computed as:

change / 100.0 = 43/100.0 = 0.43

Hence change owed = 0.43

Next quarters are computed as:

quarters = change / 25;

This becomes:

quarters = 43/25

quarters = 1

Now the remaining is computed as:

   change = change % 25;

This becomes:

   change = 43 % 25;

  change = 18

Next the dimes are computed from remaining value of change as:

dimes = change / 10;

dimes = 18 / 10

dimes = 1

Now the remaining is computed as:

   change = change % 10;

This becomes:

   change = 18 % 10

  change = 8

Next the nickels are computed from remaining value of change as:

nickels = change / 5;

nickels = 8 / 5

nickels = 1

Now the remaining is computed as:

   change = change % 5;

This becomes:

   change = 8 % 5

  change = 3

At last the pennies are computed as:

pennies = change;

pennies = 3

So the output of the entire program is:

Change Owed: 0.43                                                                                                                Quarters: 1                                                                                                                      Dimes: 1                                                                                                                         Nickels: 1                                                                                                                       Pennies: 3  

The screenshot of the output is attached.

7 0
3 years ago
In order to allow communication between vlans for exchange of data what must be used?​
lana66690 [7]
<span>In order to allow communication between vlans for exchange of data what must be used?

Router must be used</span>
4 0
3 years ago
What can you use to make sure that you have no errors in Word Online?
Free_Kalibri [48]

Answer:

You can use grammarly. It woks amazingly!

Explanation:

3 0
2 years ago
Define the following functions related to spreadsheet:<br> a.Consolidate<br> b.Subtotal
Vikki [24]

Answer:

B I hope I'm right sorry if I'm wrong

4 0
3 years ago
What is the most significant result based on the development of windmills and water wheels?
daser333 [38]
Power both wind mills and water wheels produced power which was used for textile factories ect
6 0
3 years ago
Other questions:
  • Calculate the total number of bits transferred if 200 pages of ASCII data are sent using asynchronous serial data transfer. Assu
    5·1 answer
  • How is informatics affecting banking and financial institutions?
    13·1 answer
  • Which view is used to allow a publisher to view facing pages of a publication at the same time? Normal Master Page Two-Page Spre
    5·1 answer
  • You modify a document that is saved on your computer. Where are the changes stored until you save the document?a. Radom access m
    15·1 answer
  • How I to turn this ''loop while'' in ''loop for''? var i = 0; while (i &lt; 20) { var lineY = 20 + (i * 20); line(0, lineY, 400,
    11·1 answer
  • in java how do i Write a Java program that takes ten numbers as input to calculate and print the average of the numbers.
    11·1 answer
  • A cpu handless all the instruction that it recieces from hard ware and software which are available on the computer true or fals
    7·1 answer
  • Write programs in python to display “Valid Voter”. (condition : age of person should be
    15·1 answer
  • You can perform an in-place upgrade to Windows 7 from both Windows XP and Windows Vista
    11·2 answers
  • Discuss the ways you can perform to prevent your computer/device and its data/contents from being stolen. Define two-facto authe
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!