Question

Adding Two Numbers) Write a program that defines macro SUM with two arguments, x and y,...

Adding Two Numbers) Write a program that defines macro SUM with two arguments, x and y, and use SUM to produce the following output: the sum of x and y is 13

Please type answer out fully

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include <stdio.h>
#define SUM(x, y) (x + y)

int main()
{
    int x, y;

    printf("Enter two numbers: ");
    scanf("%d%d", &x, &y);

    printf("the sum of x and y is %d\n", SUM(num1, num2));

    return 0;
}
Add a comment
Know the answer?
Add Answer to:
Adding Two Numbers) Write a program that defines macro SUM with two arguments, x and y,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a complete program that: 1) declares two local integers x and y 2) defines a...

    Write a complete program that: 1) declares two local integers x and y 2) defines a global structure containing two pointers (xptr,yptr) and an integer (z) 3) Declares a variable (mst) by the type of previous structure 4) requests the values of x and y from the user using only one scanf statement 5) sets the first pointer in the struct to point to x 6) sets the second pointer in the struct to point to y 7) uses the...

  • use python: Write a program that reads in X whole numbers and outputs (1) the sum...

    use python: Write a program that reads in X whole numbers and outputs (1) the sum of all positive numbers, (2) the sum of all negative numbers, and (3) the sum of all positive and negative numbers. The user can enter the X numbers in any different order every time, and can repeat the program if desired. Sample Run How many numbers would you like to enter? 4 Please enter number 1: 3 Please enter number 2: -4 Please enter...

  • python In a program, write a function that accepts two arguments: a list, and a number...

    python In a program, write a function that accepts two arguments: a list, and a number n. Assume that the list contains numbers. The function should display the number n, the list of numbers, and a sub list of all the numbers in the list that are greater than the number n. Initialize the list and the number n in the main function of your code and call your function, passing the list and number as arguments. Run your code...

  • Statistics Macro Assignment Write a macro to find the number of observations, max, min, sum, aver...

    Statistics Macro Assignment Write a macro to find the number of observations, max, min, sum, average and standard deviation for a column of numbers with any number of observations starting in cell A1 and proceeding downward. The number set will be of any length and include negative, zero, and positive integers. Display the results as shown below. Use the numbers below as an example. You may use the key board code “Selection.End(xlDown).Select” if you wish. Otherwise, use only VBA code...

  • Write a program that will read a list of numbers and a desired sum, then determine...

    Write a program that will read a list of numbers and a desired sum, then determine the subset of numbers in the list that yield that sum if such a subset exists. Answer from Data Structures (2nd Edition) Chapter 5.6, Problem 6PP: Does not fully answer the question. Specifically, ". . . then determine the subset of numbers in the list that yield that sum if such a subset exists" is not answered in provided solution. It should show the...

  • Write a program that will read a list of numbers and a desired sum, then determine...

    Write a program that will read a list of numbers and a desired sum, then determine the subset of numbers in the list that yield that sum if such a subset exists. Answer from Data Structures (2nd Edition) Using JAVA Chapter 5.6, Problem 6PP: Does not fully answer the question. Specifically, ". . . then determine the subset of numbers in the list that yield that sum if such a subset exists" is not answered in provided solution. It should...

  • Write a program that will read a list of numbers and a desired sum, then determine the subset of ...

    Write a program that will read a list of numbers and a desired sum, then determine the subset of numbers in the list that yield that sum if such a subset exists. Answer from Data Structures (2nd Edition) Chapter 5.6, Problem 6PP: Does not fully answer the question. Specifically, ". . . then determine the subset of numbers in the list that yield that sum if such a subset exists" is not answered in provided solution. It should show the...

  • write the C++ program to do the following 1. read in 2 numbers as ints 2....

    write the C++ program to do the following 1. read in 2 numbers as ints 2. calculate the sum, difference, product, and quotient 3. print out the four calculated numbers in the following       format           the two input numbers are ??? and ???              sum is             ????              difference is     ????              product is        ????              quotient is       ?????.?????? where ??? represents the ints and ????.???? represents the decimals. You can have any number of decimal places Example: Assume...

  • Command Line Arguments: Write a program in C Compiler that will accept two integers on command...

    Command Line Arguments: Write a program in C Compiler that will accept two integers on command line, subtract the second from the first (1st - 2nd) and display the answer. It exactly two numbers are not provided on command line, there should be a simple error message printed and the program ends with no further input, output, or calculations

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT