fork download
  1. #include <stdio.h>
  2. #include <time.h>
  3. #include <stdlib.h>
  4. int main(){
  5. int num1[20],num2[20];
  6. int min=1,max=100;
  7. int prom1=0,prom2=0;
  8. srand (time(NULL));
  9. for(int x=0;x<20;x++){
  10. num1[x]=(rand() % (max - min + 1)) + min;
  11. num2[x]=(rand() % (max - min + 1)) + min;
  12. prom1+=num1[x];
  13. prom2+=num2[x];
  14. }
  15. prom1=prom1/20;
  16. prom2=prom2/20;
  17. if(prom1<prom2){
  18. printf("vector 1:%i menor\nvector 2:%i mayor",prom1,prom2);
  19. }else{
  20. printf("vector 1:%i mayor\nvector 2:%i menor",prom1,prom2);
  21. }
  22. }
Success #stdin #stdout 0s 5300KB
stdin
Standard input is empty
stdout
vector 1:62 mayor
vector 2:44 menor