Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

SOLVE USING C++ Write a C++ program that inputs a positive double number x from the user. The program then computes and prints the value

SOLVE USING C++image text in transcribedimage text in transcribed

Write a C++ program that inputs a positive double number x from the user. The program then computes and prints the value of the following expression (all divisions should be floating-point divisions): 1 z= x +1 + Vx+1+ 2x + 1 + 0x2 + x3 Sample Session: (Values in Red are entered by the user) Enter the value for x: 1.5 z = 0.118303 Problem 2: According to the Coulomb force law, the electric force between two charged par- ticles of charge Q, and Q2 Coulombs, that are a distance r meters apart, is F = Q1 Q2 Newtons, where = 8.854 x 10-12 Farads/meter. Write a program 4 2 that calculates the force on a pair of charged particles, based on the user input of Q1 Coulombs, Q2 Coulombs, and r meters, and then computes and displays the electric force. Note: It is a good idea to declare two constants in your program as: const double epsilon=8.854e-12; // 8.854 x 10-12 const double PI=3.14159; Sample Session: (Values in Red are entered by the user) Enter the value for Q1: 1.0 Enter the value for Q2: 2.0 Enter the value for r: 10.0 Force = 1.79755e+08 Problem 3: Write a program which reads an integer number Z from the user, checks whether Z is an even number or not, and displays an appropriate message. Hint: The modulo operator (%) can be used to find out if a number is an even or odd. Sample Session 1: (Values in Red are entered by the user) Enter the value for Z: 35 Z is an odd number Sample Session 2: (Values in Red are entered by the user) Enter the value for Z: 8 Z is an even number

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Current Trends In Database Technology Edbt 2006 Edbt 2006 Workshops Phd Datax Iidb Iiha Icsnw Qlqp Pim Parma And Reactivity On The Web Munich Germany March 2006 Revised Selected Papers Lncs 4254

Authors: Torsten Grust ,Hagen Hopfner ,Arantza Illarramendi ,Stefan Jablonski ,Marco Mesiti ,Sascha Muller ,Paula-Lavinia Patranjan ,Kai-Uwe Sattler ,Myra Spiliopoulou ,Jef Wijsen

2006th Edition

3540467882, 978-3540467885

More Books

Students explore these related Databases questions

Question

Discuss all branches of science

Answered: 3 weeks ago