Skip to content

Instantly share code, notes, and snippets.

@dd1994
Created May 12, 2014 04:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dd1994/419cba4f79e7f07fbec0 to your computer and use it in GitHub Desktop.
Save dd1994/419cba4f79e7f07fbec0 to your computer and use it in GitHub Desktop.
#include <stdio.h>
void sumDiff(int, int, int *, int *);
int main(void)
{
int a, b, sum, diff;
while(scanf("%d %d", &a, &b) != EOF) {
sumDiff(a, b, &sum, &diff);
printf("sum=%d diff=%d\n", sum, diff);
}
return 0;
}
void sumDiff(int op1, int op2, int *pSum, int *pDiff)
{
*pSum = op1 + op2;
*pDiff = op1 - op2;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment