Question

Assignment - In progress Complete the form, then choose the appropriate button at the bottom Title Due Number of resubmissions allowed Accept Resubmission Until Status Homework #04 Sep 20, 2018 5:00 pm Sep 20, 2018 5:00 pm Not Started Instructions Homework: write a C funcion int odd ( int x) that returns 1 if x is odd and returns 0 if x is even. Can you Homework: Write rotate 3 ( A, B, С ) that sets A to the old value of B, sets B to old C, and C to old A. Homework: Write plusminus (x,y) that sets x to old x+ old y and sets y to old x -old y. Submission Assignment Text This assignment allows submissions using both the text box below and attached documents. Type your submis select files button to include other documents. Save frequently while working.
Can you please solve question 3, the plusminus one using C language only.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1- Without using any temporary variable

void plusminus(int *x,int *y) {

*y=*x-*y;
*x=*x-*y+*x;
}

2- Using Third Variable z

void plusminus(int *x,int *y) {
int z=0;
z=*x+*y;
*y=*x-*y;
*x=z;   
}

Add a comment
Know the answer?
Add Answer to:
Can you please solve question 3, the plusminus one using C language only. Assignment - In...
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
  • can someone please help me solve these problem in c++ language and leave useful comments below...

    can someone please help me solve these problem in c++ language and leave useful comments below so i can follow along and know what i am doing /view wa New Tab CSSO IDE 15 THE DIGIT SWAP PROBLEM Write a function named swapDigitPairs() that accepts a positive integer n as an input-output parameter which is changed to a new value similar to n's but with each pair of digits swapped in order. For example: int n = 482596; int old...

  • using C++ language!! please help me out with this homework In this exercise, you will have...

    using C++ language!! please help me out with this homework In this exercise, you will have to create from scratch and utilize a class called Student1430. Student 1430 has 4 private member attributes: lastName (string) firstName (string) exams (an integer array of fixed size of 4) average (double) Student1430 also has the following member functions: 1. A default constructor, which sets firstName and lastName to empty strings, and all exams and average to 0. 2. A constructor with 3 parameters:...

  • I NEED HELP WITH DEBUGGING A C PROGRAM! PLEASE HEAR ME OUT AND READ THIS. I...

    I NEED HELP WITH DEBUGGING A C PROGRAM! PLEASE HEAR ME OUT AND READ THIS. I just have to explain a lot so you understand how the program should work. In C programming, write a simple program to take a text file as input and encrypt/decrypt it by reading the text bit by bit, and swap the bits if it is specified by the first line of the text file to do so (will explain below, and please let me...

  • C++ Question Objectives After this homework assignment, students should be able to:  Implement user-defined structs...

    C++ Question Objectives After this homework assignment, students should be able to:  Implement user-defined structs using given specifications Use file input to populate structs Background While working to improve the LionPath website, you discovered a way to generate formatted text files that contains information about students' schedules for the upcoming semester. Consider the example below: FNAME: Andrew MINIT: S LNAME: Yu ID: 912345678 USER: auy77 CMPSC121-002-003L - M 9 05 AM 50 Lecture - T 10 05 AM 110...

  • please do number 3 signment Submission For this assignment, you submit answers by question parts. The...

    please do number 3 signment Submission For this assignment, you submit answers by question parts. The number of submissions remaining for each question part only changes if you submit or change the answer signment Scoring Your last submission is used for your score 1 - 18 points Homework 6 1. Glven Y-C+IC-A + bYd, I = lo and Yd - YDT where A-100, - .6, lo = 40 and T-50 answer the following. a. Find the reduced form equation for...

  • Assignment 6: Recursion Learning Outcomes • Learn how to craft solutions using recursion instead of loops....

    Assignment 6: Recursion Learning Outcomes • Learn how to craft solutions using recursion instead of loops. Instructions This assignment will be different than previous assignments (and most assignments which come after it). In this assignment, you will be crafting four solutions to four different problems. This assignment will also have special requirements regarding how you may code. You are not allowed to use assignment statements. This includes using preincement, postincrement, predecrement, and postdecrement. You are allowed to use assignment to...

  • Please solve only if you know how to do it. Write the code using C++ (not...

    Please solve only if you know how to do it. Write the code using C++ (not Python or Java). Show and explain everything neatly. COMMENTS (7.5% of programming assignment grade): Your program should have at least ten (10) different detailed comments explaining the different parts of your program. Each individual comment should be, at a minimum, a sentence explaining a particular part of your code. You should make each comment as detailed as necessary to fully explain your code. You...

  • Please Implement this code using Java Eclipse. CIS 1068 Assignment 8 Warm Up with Objects Due:...

    Please Implement this code using Java Eclipse. CIS 1068 Assignment 8 Warm Up with Objects Due: Wednesday, March 25 70 points (+ up to 15 extra credit) The purpose of this assignment is to give you practice implementing your own classes. It also provides extra practice with arrays. Task Implement a class Task, which is used to represent a job that should be done. It should contain the following private fields: .name text description of what job should be done...

  • i need this in C# please can any one help me out and write the full...

    i need this in C# please can any one help me out and write the full code start from using system till end i am confused and C# is getting me hard.I saw codes from old posts in Chegg but i need the ful complete code please thanks. Module 4 Programming Assignment – OO Design and implementation (50 points) Our Battleship game needs to store a set of ships. Create a new class called Ships. Ships should have the following...

  • Santa Monica College CS 20A: Data Structures with C++ Spring 2019 Name: True/False: Circle one Assignment...

    Santa Monica College CS 20A: Data Structures with C++ Spring 2019 Name: True/False: Circle one Assignment 1 ID: 1. True / False 2. True / False 3. True / False 4. True / False 5. True / False 6. True / False 7. True / False 8. True / False 9. True / False 10. True / False Variable and functions identifiers can only begin with alphabet and digit. Compile time array sizes can be non-constant variables. Compile time array...

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