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]
4 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]4 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
Find the resolving power of a Fabry-Perot interferometer in which two silver coated plates have reflectance of ???? = 0.9, if th
pochemuha

Answer:

Resolving Power=625000

Explanation:

See attached picture.

7 0
3 years ago
What do you think the top TWO game elements are that directly contribute to player immersion?
fredd [130]
Sound (like music and background sound) and detail. The music and background sound is what sets the mood for the game. In horror games, the sound is sometimes uneasy to make the player feel anxious, and when something chases you the music turns into fast-pace and making the player scared and feel that adrenaline. The detail also is a great factor. The more realistic a game is, the more it feels like real life and determines if the player will get a real reaction from the game.
6 0
3 years ago
Need help please????????!!!!!!
Alekssandra [29.7K]

Answer A the more traing the more you will know

Explanation:

4 0
3 years ago
A structural component in the shape of a flat plate 25.0 mm thick is to be fabricated from a metal alloy for which the yield str
balandron [24]

Answer:

The critical length of surface flaw = 6.176 mm

Explanation:

Given data-

Plane strain fracture toughness Kc = 29.6 MPa-m1/2

Yield Strength = 545 MPa

Design stress. =0.3 × yield strength

= 0.3 × 545

= 163.5 MPa

Dimensionless parameter. Y = 1.3

The critical length of surface flaw is given by

= 1/pi.(Plane strain fracture toughness /Dimensionless parameter× Design Stress)^2

Now putting values in above equation we get,

= 1/3.14( 29.6 / 1.3 × 163.5)^2

=6.176 × 10^-3 m

=6.176 mm

5 0
3 years ago
Read 2 more answers
Reverse masking forms a soft edge on the panel.
valina [46]
True I think I’m not sure?
7 0
2 years ago
Other questions:
  • An atomic force that can attract or repel ferrous substances is<br> known as:
    14·1 answer
  • Generally the primary source of all water supply is to be said as
    5·2 answers
  • Megan is an architect who is creating a building design. Which is a prominent technical aspect that she needs to keep in mind wh
    12·1 answer
  • Why Your first project as the new web designer at Smart Design is to increase web traffic to help boost web orders. Before you b
    6·1 answer
  • Eugene runs a company that manufactures bricks. The manufacturing process consumes a lot of energy and causes pollution, which t
    9·2 answers
  • Think of an employee object. What are several of the possible states that the object may have over time?
    6·1 answer
  • What are the partial products of 2.3 x 2.6
    15·1 answer
  • For the floor plan shown, if a = sm b= 8m, specify type of Load on Beam AHS<br> D<br> B В
    10·1 answer
  • true or false: the types of building materials that’s should be used in a project does not constitute a conditional for projects
    13·2 answers
  • Which of the following is critical when performing maintenance?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!