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
Novosadov [1.4K]
3 years ago
6

This assignment will give you more experience on the use of loops In this project, we are going to compute the number of times a

given digit D appears in a given number N. For example, the number of times 5 appears in 1550 is 2. The number of times 0 appears in 1550 is 1. The number of times 3 appears in 155 is 0. Etc.
Engineering
1 answer:
musickatia [10]3 years ago
3 0

Answer:

import java.io.BufferedReader;

import java.io.File;

import java.io.FileReader;

import java.io.IOException;

import java.util.Scanner;

import java.util.StringTokenizer;

public class Tester {

public static void main(String[] args) throws IOException {

Scanner in=new Scanner(System.in);

   System.out.println("Enter a Number =======>");

   long N ;

   while (!in.hasNextLong()) {

       System.out.println("That's not a number!");

       in.next();

   }

   N=in.nextLong();

   System.out.println("Number Entered is =======>"+N);

   System.out.println("Enter a Digit =======>");

   int D;

   while (!in.hasNextLong()) {

       System.out.println("That's not a number!");

       in.next();

   }

   D=in.nextInt();

   System.out.println("Digit Entered is =======> "+ D);

   long que=N;

   int rem;

   int count=0;

   while(true){

       long temp;

       temp = (long)que/10;

       

       rem = (int) (que % 10);

       System.out.println(temp+" "+ que+" "+rem);

       if(rem==D) count++;

       que=temp;

       if(que==0) break;

       

   }

   System.out.println("The number of "+ D+"'s in "+ N + " is "+ count );;

   

   

}

}

Explanation:

  • Divide the que variable by 10 and assign its result to the temp variable.
  • Calculate the remainder.
  • Increment the count if the remainder is equal to the value of D variable and assign the value of que to temp variable.
You might be interested in
with a digital system, if you have measured incorrectly and use too low of a kvp for adequate penetration, what do you need to d
Lubov Fominskaja [6]

The x-ray beam's penetrating power is regulated by kVp (beam quality). Every time an exposure is conducted, the x-rays need to be powerful (enough) to sufficiently penetrate through the target area.

<h3>How does kVp impact the exposure to digital receptors?</h3>

The radiation's penetration power and exposure to the image receptor both increase as the kVp value is raised.

<h3>Exposure to the image receptor is enhanced with an increase in kVp, right?</h3>

Due to an increase in photon quantity and penetrability, exposure at the image receptor rises by a factor of five of the change in kVp, doubling the intensity at the detector with a 15% change in kVp.

To know more about kVp visit:-

brainly.com/question/17095191

#SPJ4

5 0
1 year ago
- You have a bin wrench turning a 1/2 13 UNC bolt. You overcome 1200 lbs of resistance when you
andrew11 [14]

Fr

is my guess but yeah

6 0
3 years ago
Horizontal shear forces and, consequently, horizontal shear stresses are caused in a flexural member at those locations where th
jek_recluse [69]

Answer:

False

Explanation:

When the horizontal shear forces act on the surface there is transverse shear stress at a particular point which is equal in magnitude. Pure bending is less common than a non uniform bending because the beam is not in equilibrium.

5 0
3 years ago
Consider the following list. list = {24, 20, 10, 75, 70, 18, 60, 35} Suppose that list is sorted using the insertion sort algori
Greeley [361]

Answer:

Option B

10,20,24,75,70,18,60,35

Explanation:

The first, second and third iteration of the loop will be as follows

insertion sort iteration 1: 20,24,10,75,70,18,60,35

insertion sort iteration 2:10,20,24,75,70,18,60,35

insertion sort iteration 3: 10,20,24,75,70,18,60,35

8 0
3 years ago
What properties should the head of a carpenter’s hammer possess? How would you manufacture a hammer head?
BabaBlast [244]

Properties of Carpenter's hammer possess

Explanation:

1.The head of a carpenter's hammer should possess the impact resistance, so that the chips do not peel off the striking face while working.

2.The hammer head should also be very hard, so that it does not deform while driving or eradicate any nails in wood.

3.Carpenter's hammer is used to impact smaller areas of an object.It can drive nails in the wood,can crush  the rock and shape the metal.It is not suitable for heavy work.

How hammer head is manufactured :

1.Hammer head is produced by metal forging process.

2.In this process metal is heated and this molten metal is placed in the cavities said to be dies.

3.One die is fixed and another die is movable.Ram forces the two dies under the forces which gives the metal desired shape.

4.The third process is repeated for several times.

5 0
3 years ago
Other questions:
  • What are the two safety precautions taken before driving a car​
    12·1 answer
  • The reverse water-gas shift (RWGS) reaction is an equimolar reaction between CO2 and H2 to form CO and H2O. Assume CO2 associati
    10·1 answer
  • To measure the voltage drop across a resistor, a _______________ must be placed in _______________ with the resistor. Ammeter; S
    9·1 answer
  • Consider the two wood pieces that are connected by a velcro as indicated below. The block is subjected to a tension force P and
    6·2 answers
  • The pressure intensity at a point in a fluid is equal in all directions a.true b.false​
    12·1 answer
  • Uber drivers are considered 'independent contractors' and thus can apply for business licenses.
    11·2 answers
  • can someone please define these three vocabulary words for my stem class i will give brainliest if i can figure out how
    15·1 answer
  • State 3 advantages and 3 disadvantages of unit rate contract​
    10·1 answer
  • Hello it's my new id<br>I am numu ​
    15·1 answer
  • Provide five strategies to stimulate brainstorming. (according to PLTW)
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!