Answered step by step
Verified Expert Solution
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++
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 numberStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started