ousef is a good student in Math and Programming. Every Math lesson ass a Math problem to be solved using a C++ program. Yousef fascina egets a full mark. day he took the following task in the Math lesson: you have an integer number N consisting of a list of digits (D1, D2, D3, sult of the following equation:

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Challenge task
Yousef is a good student in Math and Programming. Every Math lesson his teacher gives his
class a Math problem to be solved using a C++ program. Yousef fascinated by this, and sometimes
he gets a full mark.
Today he took the following task in the Math lesson:
If you have an integer number N consisting of a list of digits (D1, D2, D3, ... Dm), find and print the
result of the following equation:
Dm – 1
Dm
+
D1
+
2
An example:
If the integer is 2356 then
6 5
+
2
- +
2
3
= -1.000
2
Can you help Yousef in order to get a full mark in this task?
Constraints
20 < Ns 10°
Input Format
An integer number N
E Output Format
Print the following message
The Result is X
where X represents the result of the equation in 3 decimal places.
O Sample #1
Input
2356
Output
The Result is -1.000
O Sample #2
Input
21
Output
The Result is 0.500
Transcribed Image Text:Challenge task Yousef is a good student in Math and Programming. Every Math lesson his teacher gives his class a Math problem to be solved using a C++ program. Yousef fascinated by this, and sometimes he gets a full mark. Today he took the following task in the Math lesson: If you have an integer number N consisting of a list of digits (D1, D2, D3, ... Dm), find and print the result of the following equation: Dm – 1 Dm + D1 + 2 An example: If the integer is 2356 then 6 5 + 2 - + 2 3 = -1.000 2 Can you help Yousef in order to get a full mark in this task? Constraints 20 < Ns 10° Input Format An integer number N E Output Format Print the following message The Result is X where X represents the result of the equation in 3 decimal places. O Sample #1 Input 2356 Output The Result is -1.000 O Sample #2 Input 21 Output The Result is 0.500
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY