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
BARSIC [14]
4 years ago
11

Write a c++ program that reads the contents of a file containing integer numbers, then for

Engineering
1 answer:
Ksenya-84 [330]4 years ago
7 0

The sum of digits C++ program is written below

<u>Explanation:</u>

#include <iostream>  

using namespace std;  

int main()  

{  

int number,sum=0,temp;    

cout<<"Enter a number: ";    

cin>>number;    

while(number>0)    

{    

temp=number%10;    

sum=sum+temp;    

number=number/10;    

}    

cout<<"Sum of the given digit is= "<<sum<<endl;    

return 0;  

}  

You might be interested in
Write torsion equation and explain the importance of each components.<br>​
Elanso [62]
The equations are based on the following assumptions

1) The bar is straight and of uniform section
2) The material of the bar is has uniform properties.
3) The only loading is the applied torque which is applied normal to the axis of the bar.
4) The bar is stressed within its elastic limit.

Nomenclature

T = torque (Nm)
l = length of bar (m)
J = Polar moment of inertia.(Circular Sections) ( m^4)
J' = Polar moment of inertia.(Non circluar sections) ( m^4 )
K = Factor replacing J for non-circular sections.( m^4)
r = radial distance of point from center of section (m)
ro = radius of section OD (m)
τ = shear stress (N/m^2)
G Modulus of rigidity (N/m^2)
θ = angle of twist (radians)

4 0
3 years ago
In this exercise, you will write a Point structure that represents a space in two-dimensional space. This Point should have both
Afina-wow [57]

Answer:

Check the explanation

Explanation:

Points to consider:

We need to take the input from the user

We need to find the manhatan distance and euclidian using the formula

(x1, y1) and (x2, y2) are the two points

Manhattan:

|x_1 - x_2| + |y_1 - y_2|

Euclidian Distance:

\sqrt{(x1 - yl)^2 + (x2 - y2)^2)}

Code

#include<stdio.h>

#include<math.h>

struct Point{

  int x, y;

};

int manhattan(Point A, Point B){

  return abs(A.x - B.x) + abs(A.y- B.y);

}

float euclidean(Point A, Point B){

  return sqrt(pow(A.x - B.x, 2) + pow(A.y - B.y, 2));

}

int main(){

  struct Point A, B;

  printf("Enter x and Y for first point: ");

  int x, y;

  scanf("%d%d", &x, &y);

  A.x = x;

  A.y = y;

  printf("Enter x and Y for second point: ");

  scanf("%d%d", &x, &y);

  B.x = x;

  B.y = y;

  printf("Manhattan Distance: %d\n", manhattan(A, B));

  printf("Euclidian Distance: %f\n", euclidean(A, B));

 

}

Sample output

8 0
4 years ago
If a heat engine has an efficiency of 30% and its power output is 600 W, what is the rate of heat input from the combustion phas
jarptica [38.1K]

Answer:

The heat input from the combustion phase is 2000 watts.

Explanation:

The energy efficiency of the heat engine (\eta), no unit, is defined by this formula:

\eta = \frac{\dot W}{\dot Q} (1)

Where:

\dot Q - Heat input, in watts.

\dot W - Power output, in watts.

If we know that \dot W = 600\,W and \eta = 0.3, then the heat input from the combustion phase is:

\eta = \frac{\dot W}{\dot Q}

\dot Q = \frac{\dot W}{\eta}

\dot Q = \frac{600\,W}{0.3}

\dot Q = 2000\,W

The heat input from the combustion phase is 2000 watts.

8 0
3 years ago
Explain The Basic Difference Between Bs2 And Bs3 Engine.​
snow_tiger [21]

Answer:

The main difference between the bs2 and bs3 engine is to present in the catalytic converter. And in bs2 engines the catalytic converter is does not used for the formation of hc and co. In bs3 engine there is no harmful emissions in the hc and co

3 0
3 years ago
When was the first black or white hole discovered?
ivolga24 [154]

Answer:

1964

Explanation:

It was discovered in 1964 when a pair of Geiger counters were carried on board a sub-orbital rocket launched from New Mexico.

3 0
4 years ago
Other questions:
  • The correct statement about the lift and drag on an object is:_______
    7·2 answers
  • Consider a fully-clamped circular diaphragm poly-Si with a radius of 250 μm and a thickness of 4 μm. Assume that Young’s modulus
    14·1 answer
  • What is the difference Plastic vs elastic deformation.
    13·1 answer
  • Time complexity of merge sort
    15·1 answer
  • Sketch the velocity profile for laminar and turbulent flow.
    15·1 answer
  • The electricity generated by wind turbines annually in kilowatt-hours per year is given in a file. The amount of electricity is
    5·2 answers
  • When checking the resistance of a dual voltage wye motor, there should be ____ resistance readings. 1) twelve 2) six 3) three
    12·1 answer
  • Explain why surface temperature increases when two bodies are rubbed against each other. What is the significance of temperature
    13·1 answer
  • I need this asap thank you :) plzzzzz When the spring on a mousetrap car is fully unwound, the force acting on the car is _____.
    11·1 answer
  • Two engineers are to solve an actual heat transfer problem in a manufacturing facility. Engineer A makes the necessary simplifyi
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!