Advertisement
Guest User

asdas

a guest
Jan 24th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.48 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3.  
  4.  
  5. int main(){
  6. int t1[20], t2[20];
  7. int i, j, max1=0, max2=0;
  8. srand(time(NULL));
  9.  
  10. for (i=0;i<20;i++) t1[i]=rand()%100-49; // losowanie -50 ; 50
  11. t1[1]= 99;  t1[10]= 99;  t1[15]= 99;
  12.  
  13. printf("TAB: ");
  14. for (i=0;i<20;i++) printf("%d ",t1[i]);
  15.  
  16. for (i=0; i<20; i++){
  17.     if (t1[i]>max1) max1=t1[i];
  18. }
  19. for (i=0; i<20; i++){
  20.     if (t1[i]<max1 && t1[i]>max2) max2=t1[i];
  21. }
  22.  
  23. printf("\nMax1:%d Max2: %d", max1, max2);
  24.  
  25.  
  26.  
  27.  
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement