Write a program that reads an integer number N from the user. Then, calculates and displays the value of F according to the following equation. Display F with two decimal places. F = −( + 4 + 8 + 12 ... or +2 x N)
Write a program that reads an integer number N from the user. Then, calculates and displays the value of F according to the following equation. Display F with two decimal places. F = −( + 4 + 8 + 12 ... or +2 x N)
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
python
![**Program Overview for Calculating F**
This educational content explains how to write a program that reads an integer number \( N \) from the user. The program then calculates and displays the value of \( F \) according to a specified equation. The result should be displayed with two decimal places.
### Equation
The formula provided for \( F \) is:
\[
F = - \left( \frac{1}{1} + 4 - \frac{1}{3} + 8 - \frac{1}{5} + 12 \ldots - \frac{1}{N} \quad \text{or} \quad + 2 \times N \right)
\]
### Examples
1. **Input/Output Example 1:**
- **Input:** 5
- **Output:** 10.47
This indicates that when \( N \) is 5, the program calculates \( F \) as 10.47.
2. **Input/Output Example 2:**
- **Input:** 8
- **Output:** 38.32
Here, for \( N \) equal to 8, the calculated value of \( F \) is 38.32.
### Instructions
1. **Read an integer \( N \) from the user.**
2. **Implement the calculation** using the given formula. This involves summing a combination of fractions, constants, and the integer \( N \).
3. **Display the result** with two decimal places to ensure accuracy and clarity.
**Note:** This content is designed to guide the implementation of a mathematical program and calculation, making it particularly useful for educational purposes in programming and mathematics.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F843115a9-e77a-4d5a-a57b-ebafe5aede7d%2Ff7c32114-42aa-40ea-9f5a-ceb8efe84dd3%2Faye3zp6_processed.png&w=3840&q=75)
Transcribed Image Text:**Program Overview for Calculating F**
This educational content explains how to write a program that reads an integer number \( N \) from the user. The program then calculates and displays the value of \( F \) according to a specified equation. The result should be displayed with two decimal places.
### Equation
The formula provided for \( F \) is:
\[
F = - \left( \frac{1}{1} + 4 - \frac{1}{3} + 8 - \frac{1}{5} + 12 \ldots - \frac{1}{N} \quad \text{or} \quad + 2 \times N \right)
\]
### Examples
1. **Input/Output Example 1:**
- **Input:** 5
- **Output:** 10.47
This indicates that when \( N \) is 5, the program calculates \( F \) as 10.47.
2. **Input/Output Example 2:**
- **Input:** 8
- **Output:** 38.32
Here, for \( N \) equal to 8, the calculated value of \( F \) is 38.32.
### Instructions
1. **Read an integer \( N \) from the user.**
2. **Implement the calculation** using the given formula. This involves summing a combination of fractions, constants, and the integer \( N \).
3. **Display the result** with two decimal places to ensure accuracy and clarity.
**Note:** This content is designed to guide the implementation of a mathematical program and calculation, making it particularly useful for educational purposes in programming and mathematics.
Expert Solution

Step 1
Introduction:
In this question, we are asked to write a python program to get the sum of given series and print it.
Step by step
Solved in 3 steps with 3 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education