fork download
  1. #include <stdio.h>
  2.  
  3. void cal(int x, int y,int *add,int *sub);
  4. int main(void) {
  5. // your code goes here
  6. int n1,n2,a,b;
  7.  
  8. scanf("%d",&n1);printf("n1 : %d ",n1);
  9. scanf("%d",&n2);printf("n2 : %d \n",n2);
  10. cal(n1,n2,&a,&b);
  11. printf("*add : %d, *sub : %d\n",a,b);
  12. return 0;
  13. }
  14. void cal(int x,int y,int *add,int *sub){
  15. *add=x+y;
  16. *sub=x-y;
  17. }
Success #stdin #stdout 0.01s 5272KB
stdin
4 3
stdout
n1 : 4 n2 : 3 
*add : 7, *sub : 1