Tchae

Untitled

Sep 20th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.67 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #define size 10
  5.  
  6. int Saume(int t1[],int t2[]);
  7. void Aff(int t[]);
  8.  
  9. int tablo1[size], tablo2[size], i;
  10.  
  11. int main()
  12. {
  13.      srand(time(NULL));
  14.     for (i=0;i<size;i++)
  15.     {
  16.         tablo1[i]=rand()%50;
  17.         tablo2[i]=rand()%50;
  18.     }  
  19.     Aff(tablo1);
  20.     Aff(tablo2);
  21.     Aff(Saume(tablo1,tablo2));  
  22.     exit (EXIT_SUCCESS);
  23. }
  24.  
  25. void Aff(int t[])
  26. {
  27.     int j;
  28.     for (j=0;j<size;j++) printf("%d\t", t[j]);
  29.     printf("\n");
  30. }
  31.  
  32. int Saume(int t1[],int t2[])
  33.     {
  34.         int tabres[size], j;
  35.         for (j=0;j<size;j++) tabres[j]=tablo1[j]+tablo2[j];
  36.         return (tabres);
  37.     }
Advertisement
Add Comment
Please, Sign In to add comment