How to call jQuery function with multiple parameters?

Determine the following information about a positive integer that is passed into a function:?

  • Language C Determine the following information about a positive integer that is passed into a function: (a) is the value a multiple of 7, 11, or 13 (a single yes or no) (b) is the sum of the digits of the value even or odd (c) is the value a prime number Your program must query the user for a positive integer (in main or through a call to an input function), call one function that calculates all three answers, and returns all three answers to main as three reference (output) parameters. A solution that does not use three reference parameters from a single function to report the results to main is not acceptable; the whole purpose of this assignment is to demonstrate that you are able to use reference parameters. If, for example, the user enters 26, your program should report that the number is a multiple of 7, 11, or 13 (26 is a multiple of 13); that the sum of the digits is even (2+6=8 which is even), and that the number is not prime. These results must be reported in words (don't just print out unannotated numbers). I have all of the mathematical equations correct i am just having trouble setting up main and having all the answers sent back to main in the same function. All 3 answers need to be passed by reference can anyone show me how main should look and how the calling function returns the values of each. Thank you

  • Answer:

    #include <stdio.h> void get_info(int ,int *, int * ,int *); int main(void){ int m7,sum_dig_odd,is_prime; int n; n=26; get_info(n, & m7, &sum_dig_odd, &is_prime); if(m7) printf("%d is a multiple of 7 11 or 13\n",n); printf("the sum of the digits is "); if(sum_dig_odd) printf("odd\n"); else printf("even\n"); if(is_prime) printf("the number is prime\n"); return 0; } void get_info(int n,int * m, int *d ,int *p){ int t; *m=0; if(n%7 ==0 || n%11==0 || n%13 ==0) *m=1; *d=0; t=n; while(t){ *d+=t%10; t/=10; } *d=*d&1; // check for odd/even is prime is left as an exercise.... return; }

Craig at Yahoo! Answers Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.