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
A heat engine that rejects waste heat to a sink at 520 R has a thermal efficiency of 35 percent and a second- law efficiency of
xeze [42]

Answer:

The source temperature is 1248 R.

Explanation:

Second law efficiency of the engine is the ratio of actual efficiency to the maximum possible efficiency that is reversible efficiency.

Given:  

Temperature of the heat sink is 520 R.

Second law efficiency is 60%.

Actual thermal efficiency is 35%.

Calculation:  

Step1

Reversible efficiency is calculated as follows:

\eta_{II}=\frac{\eta_{a}}{\eta_{rev}}

0.6=\frac{0.35}{\eta_{rev}}

\eta_{rev}=0.5834

Step2

Source temperature is calculated as follows:

\eta_{rev}=1-\frac{T_{L}}{T}

\eta_{rev}=1-\frac{520}{T}

0.5834=1-\frac{520}{T}

T = 1248 R.

The heat engine is shown below:

Thus, the source temperature is 1248 R.

6 0
3 years ago
FD=CD*((P*(V^2)*A)/2)<br><br>Please solve for V
REY [17]

Answer:

The answer is V = √2FD ÷ CD × PA

Explanation:

FD = CD × PV²A ÷ 2

V² = 2FD ÷ CD × PA

V = √2FD ÷ CD × PA

Thus, The value of V is V = √2FD ÷ CD × PA

 

<u>-TheUnknownScientist 72</u>

7 0
2 years ago
. . . . . . . . . . ..........
Naddika [18.5K]

Answer: Thx for points...

Explanation:

Heres Random Info About Enginnering (because why not): Engineers are involved in all aspects of interactive TV technology, from designing new cables, to creating new film emulsions, to engineering better sound quality. This technology allows viewers to select any program, film, or game from more than 500 channels. Engineers play an instrumental role in the theme park industry?

Hope This Helps Someday!

5 0
3 years ago
How are engine bearings lubricated?
Musya8 [376]

Answer:

Engine bearings are lubricated by <u>motor oils</u> constantly supplied in sufficient amounts to the bearings surfaces. Lubricated friction is characterized by the presence of a thin film of the pressurized lubricant

Explanation:

7 0
3 years ago
Read 2 more answers
The diesel exhaust fluid is injected​ ________.
Maurinko [17]

Explanation:

The diesel exhaust fluid is injected c just in front of the muffler.

6 0
3 years ago
Read 2 more answers
Other questions:
  • Can a 1½ " conduit, with a total area of 2.04 square inches, be filled with wires that total 0.93 square inches if the maximum f
    8·1 answer
  • LUNES MARTES MIÉRCOLES JUEVES VIERNES SÁBADO DOMINGO
    10·1 answer
  • Which of the following color schemes is composed of hues next to eachother on the color wheel ?
    7·1 answer
  • You live on a street that runs East to West. You just had 2 inche of snow and you live on the North side of the street. You retu
    14·1 answer
  • Project 8:The Harris-Benedict equation estimates the number of calories your body needs to maintain your weight if you do no exe
    5·1 answer
  • A controller on an electronic arcade game consists of a variable resistor connected across the plates of a 0.227 μF capacitor. T
    6·1 answer
  • Can a real refrigerator have higher COP than the COP of the Carnot refrigerator?
    7·2 answers
  • If i build thing a and thing a builds thing b did i build thing b
    5·2 answers
  • A heat pump operates on a vapor-compression refrigeration cycle with R-134a as the working fluid. The refrigerant enters the com
    13·1 answer
  • Help I need to know if it’s true or false
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!