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
How can we love our country? Not by words but by deeds. - Jose P. Laurel
Vadim26 [7]

Answer:

1. You have the courage to help without expecting a reward.

2. Because actions are more eloquent than words. Actions are far more valuable and counted than  words, and that's how she inspired me.

3. Doing simple things that can make someone grateful and happy  without knowing that someone is inspired and motivated by your good deeds, and also doing some interesting things By.

Explanation:

6 0
3 years ago
A 100 ft long steel wire has a cross-sectional area of 0.0144 in.2. When a force of 270 lb is applied to the wire, its length in
blondinia [14]

Answer:

(a) The stress on the steel wire is 19,000 Psi

(b) The strain on the steel wire is 0.00063

(c) The modulus of elasticity of the steel is 30,000,000 Psi

Explanation:

Given;

length of steel wire, L = 100 ft

cross-sectional area, A = 0.0144 in²

applied force, F = 270 lb

extension of the wire, e = 0.75 in

<u>Part (A)</u> The stress on the steel wire;

δ = F/A

   = 270 / 0.0144

δ  = 18750 lb/in² = 19,000 Psi

<u>Part (B)</u> The strain on the steel wire;

σ = e/ L

L = 100 ft = 1200 in

σ = 0.75 / 1200

σ = 0.00063

<u>Part (C)</u> The modulus of elasticity of the steel

E = δ/σ

   = 19,000 / 0.00063

E = 30,000,000 Psi

4 0
3 years ago
When water precipitates from the sky, runs off downhill along the ground, or infiltrates down into the soil, its gravitational p
agasfer [191]

Answer:

Geothermal energy.

Explanation:

Geothermal energy is called a renewable energy source because the water is replenished by rainfall, and the heat is continuously produced by the earth.

8 0
3 years ago
Ages have been identified by the materials developed and used in those eras.
Westkost [7]
Ok what is the question
6 0
3 years ago
Read 2 more answers
Given a force of 72 lbs at a distance of 15 ft, calculate the moment produced.​
Elis [28]

Answer:

1425.78 N.m

Explanation:

Moments of force is calculated as ;

Moments= Force * distance

M= F*d

The S.I unit for moment of force is Newton-meter (N.m)

Given in the question;

Force = 72 lbs

1 pound = 4.45 N

72 lbs = 4.45 * 72=320.4 N

Distance= 15 ft

1ft= 0.3048 m

15 ft = 15*0.3048 = 4.57 m

d= 4.57 m

M= F*d

M=320.4*4.57 =1425.78 N.m

5 0
3 years ago
Other questions:
  • Water vapor at 6 MPa, 500°C enters a turbine operating at steady state and expands to 20 kPa. The mass flow rate is 3 kg/s, and
    8·1 answer
  • A market research survey has 15 questions and will be sent to 500 people. What is the total cost to conduct survey if it has a $
    12·1 answer
  • Which of the following is not an example of heat generation? a)- Exothermic chemical reaction in a solid b)- Endothermic Chemica
    15·1 answer
  • List two common units of measurement to describe height
    5·2 answers
  • What is an air mass?​
    5·2 answers
  • Define Viscosity. What are the main differences between viscous and inviscid flows?
    10·1 answer
  • In science, a force is a push or a pull.<br> is it true or false ?
    5·1 answer
  • The quantity of bricks required increases with the surface area of the wall, but the thickness of a masonry wall does not affect
    10·2 answers
  • list out main types of material used in design and Manufacture of product give one example for each in engineering application ?
    10·1 answer
  • Which of the given strategies is specifically a competitive advantage sustainment strategy?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!