Advertisement
hpilo

Chapter6_Func_Ex8

Dec 15th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. /*
  2. =====================================================
  3. chapter 6: Functions
  4.  
  5. Ex8:
  6. =====================================================
  7. */
  8. public class MyProgram {
  9. public static int[] add(int arr1[],int arr2[]){
  10.  
  11. int size= arr1.length>arr2.length? (arr1.length)+1: (arr2.length)+1;
  12. int result[]=new int[size];
  13. int carry=0;
  14.  
  15. for(int i=(arr1.length)-1; i>0;i--){}
  16.  
  17. return(result);
  18. }
  19. public static void main(String[] args) {
  20.  
  21. int arr1[]={1,2,3,4};
  22. int arr2[]={9,7};
  23. int arr3[]={9,9,9,9};
  24.  
  25.  
  26. int res[];
  27. res=add(arr1,arr2);
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement