Problem C. 75462. Modular addition Input file: Output file: Time limit: standard input standard output 1 second 256 megabytes Memory limit: In this problem, you are given three integers a, b and z. Your task is to write a function that ca a + b and returns a remainder after dividing this sum by z. Your code might look as follows: int modadd(int a, int b, int x) { // your code that calculates a + b and // returns a remainder after dividing it by x Note. All the accepted solutions for this problem will be rechecked by assistants. Input The first line of input contains three space-separated integers a, b and z (1< a, b< 1000, 1 <1: Output Output a single mumber – a remainder of dividing a + b by x. Examples standard input standard output 20 20 30 10 30 40 100 5 17 22 70 162

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section6.4: A Case Study: Rectangular To Polar Coordinate Conversion
Problem 9E: (Numerical) Write a program that tests the effectiveness of the rand() library function. Start by...
icon
Related questions
Question

easy code please and simple libraries

Problem C. 75462. Modular addition
Input file:
Output file:
Time limit:
Memory limit:
standard input
standard output
1 second
256 megabytes
In this problem, you are given three integers a, b and z. Your task is to write a function that caleulates
a + b and returns a remainder after dividing this sum by r.
Your code might look as follows:
int modadd(int a, int b, int x) {
// your code that calculates a + b and
// returns a remainder after dividing it by x
Note. All the accepted solutions for this problem will be rechecked by assistants.
Input
The first line of input contains three space-separated integers a, b and r (1< a, b < 1000, 1 <r< 100).
Output
Output a single number – a remainder of dividing a +b by x.
Examples
standard input
standard output
20 20 30
10
30 40 100
70
5 17 22
162
1
Transcribed Image Text:Problem C. 75462. Modular addition Input file: Output file: Time limit: Memory limit: standard input standard output 1 second 256 megabytes In this problem, you are given three integers a, b and z. Your task is to write a function that caleulates a + b and returns a remainder after dividing this sum by r. Your code might look as follows: int modadd(int a, int b, int x) { // your code that calculates a + b and // returns a remainder after dividing it by x Note. All the accepted solutions for this problem will be rechecked by assistants. Input The first line of input contains three space-separated integers a, b and r (1< a, b < 1000, 1 <r< 100). Output Output a single number – a remainder of dividing a +b by x. Examples standard input standard output 20 20 30 10 30 40 100 70 5 17 22 162 1
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Function Arguments
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr