Question

Write a C program that has the following statements, and use two-way parameter to increase a by 10 in fun(). You can return a

0 0
Add a comment Improve this question Transcribed image text
Answer #1

code:

#include <stdio.h>

int fun(){
return 5;
}

int main()
{
int a,b;
a = 10;
b = a + fun();
printf("With the function call on the right, ");
printf(" b is: %d\n",b);
a = 10;
b = fun() + a;
printf("With the function call on the left, ");
printf(" b is: %d\n", b);
}

#include <stdio.h> 9 10 11 12 13 int fun() { return 5; } 14 19 15 int main() 16 - { 17 int a,b; a = 10; b = a + fun(); printf

OUTPUT:

With the function call on the right, bis: 15 With the function call on the left, bis: 15

Add a comment
Know the answer?
Add Answer to:
Write a C program that has the following statements, and use two-way parameter to increase a...
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
  • C program help: Write a C program that uses three functions to perform the following tasks:...

    C program help: Write a C program that uses three functions to perform the following tasks: – The first function should read the price of an item sold at a grocery store together with the quantity from the user and return all the values to main(). example: #include void getInput(int *pNum1, int *pNum2); // note: *pNum1 & *pNum2 are pointers to ints int main () {    int numDucks,numCats;    getInput(&numDucks, &numCats); // passing addresses of num1 & num2 to...

  • This is for C program CHALLENGE ACTIVITY 6.5.1: Unit testing. Add two more statements to main0...

    This is for C program CHALLENGE ACTIVITY 6.5.1: Unit testing. Add two more statements to main0 to test inputs 3 and-1. Use print statements similar to the existing one (don't use assert) 1 #include <stdio.h> test 3 // Function returns origNum cubed 4 int CubeNum(int origNum) t 5 return origNum origNumorigNum; 6 b All tests passed 8 int main void) 10 printfC"Testing started\n"; printf("2: Expecting 8, got: %d\n", CubeNum(2)); 14 Your solution goes here 15 16 printfC Testing completed\n"; 17...

  • Convert the C program into a C++ program.Replace all C input/output statements with C++ statements (cin,...

    Convert the C program into a C++ program.Replace all C input/output statements with C++ statements (cin, cout, cin.getline) . Re-make the func function by the following prototype: void func( double, double &); #include int user_interface(); double func(double); void print_table(); int main (int argc, char *argv[]) {    print_table(user_interface());    return 0 ; } int user_interface(int val){    int input = 0;    printf("This function takes in x and returns an output\n");    printf("Enter Maximum Number of X:");    scanf("%d", &input);...

  • Please write MIPS program that runs in QtSpim (ex: MipsFile.s) Write a MIPS program that will...

    Please write MIPS program that runs in QtSpim (ex: MipsFile.s) Write a MIPS program that will read in a base (as an integer) and a value (nonnegative integer but as an ASCII string) in that base and print out the decimal value; you must implement a function (which accepts a base and an address for a string as parameters, and returns the value) and call the function from the main program. The base will be given in decimal and will...

  • Hi, this program is in C. Can you a pass by pointer in this program. Thanks. #include //function ...

    Hi, this program is in C. Can you a pass by pointer in this program. Thanks. #include //function declaration/prototype here int main(int argc, char * argv[]) { int num1, num2;    printf("Please enter two integers (separated by ,):\n"); scanf("%d,%d", &num1, &num2); //enter two integers separated by a comma (,)    printf("num1 stores: %d\n", num1); printf("num2 stores: %d\n", num2);    /*make a function call to make sure the followings are true after we call the function (1) variable num1 stores the larger value after...

  • Write the proposed program in Java, JavaScript, and Python. Run them and compare the results. Submit...

    Write the proposed program in Java, JavaScript, and Python. Run them and compare the results. Submit source code for 3 programs. Let the function fun be defined as int fun(int* k) { *k += 4; return 3 * (*k) - 1; } Suppose fun is used in a program as follows: void main() { int i = 10, j = 10, sum1, sum2; sum1 = (i / 2) + fun(&i); sum2 = fun(&j) + (j / 2); }

  • What is the output of the following c program. Why, Can you tell me how do...

    What is the output of the following c program. Why, Can you tell me how do you solve it? #include <stdio.h> int fun(int n) { if(n==0) { return 1; } else return 7 + fun(n-2); } int main() { printf("%d", fun (4)); return 0; | }

  • Write an assembly language program that corresponds to the following C program: int width; int length;...

    Write an assembly language program that corresponds to the following C program: int width; int length; int perim; int main () { scanf ("%d%d", &width, &length); perim = (width + length) * 2; printf ("width = %d\n", width); printf ("length = %d\n\n", width); printf ("perim = %d\n", perim); return 0; }

  • please write the procedure how you got the answer 30 and 31 Use the program below...

    please write the procedure how you got the answer 30 and 31 Use the program below for problems 30 - 31 #include<stdio.h> int calcfactorial (int, int, int); int main() printf("result: %d\n", calcfactorial (7, 2, 5)); return(0); int calcfactorial(int n, int a, int b) int fact = 1; if(n > 1) if (n >= a && n <= b) fact = n* calcfactorial(n - 1, a, b); else fact = calcfactorial(n - 1, a, b); return(fact); 30. Which of the following...

  • Write the output of the following function assuming it was called with the given function call...

    Write the output of the following function assuming it was called with the given function call a. Call: fun(4, 10); fo void fun (int a, int b) cout << b a << endl; if(a >= b) { 나 cout < "boo\n"; return; fun(a 1, b 1); cout << a << endl;

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