Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- int main(){
- int t1[20], t2[20];
- int i, j, max1=0, max2=0;
- srand(time(NULL));
- for (i=0;i<20;i++) t1[i]=rand()%100-49; // losowanie -50 ; 50
- t1[1]= 99; t1[10]= 99; t1[15]= 99;
- printf("TAB: ");
- for (i=0;i<20;i++) printf("%d ",t1[i]);
- for (i=0; i<20; i++){
- if (t1[i]>max1) max1=t1[i];
- }
- for (i=0; i<20; i++){
- if (t1[i]<max1 && t1[i]>max2) max2=t1[i];
- }
- printf("\nMax1:%d Max2: %d", max1, max2);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement