home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume17 / contest-prog / part01 / prob4.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-02-06  |  768 b   |  47 lines

  1. main(){
  2. /*    integer odds(100),evens(100)*/
  3.     int odds[101],evens[101];
  4.     int k; /*had to be added... fortran implicitly declared it*/
  5. /*    integer a*/
  6.     int a;
  7. /*    integer i,j*/
  8.     int i,j;
  9.  
  10. /*    i=1*/
  11. /*    j=1*/
  12.     i=j=1;
  13. /*    do 10 k=1,100*/
  14.     for(k=1;k<=100;k++)odds[k]=evens[k]= -1;
  15. /*    odds(k)= -1*/
  16. /*10    evens(k)= -1*/
  17.  
  18. /*1    read*,a*/
  19. loop: scanf("%d",&a);
  20. /*    if(a.lt.0)goto 4*/
  21.     if(a<0)goto out;
  22. /*    if( mod(a,2) .eq. 0)goto 2*/
  23. /*    odds(i)=a*/
  24. /*    i= i+1*/
  25. /*    goto 3*/
  26. /*2    evens(j)=a*/
  27. /*    j=j+1*/
  28. /*3    continue*/
  29.     if(a%2)odds[i++]=a;
  30.     else evens[ j++]=a;
  31. /*    goto 1*/
  32.     goto loop;
  33.  
  34. /*4    continue*/
  35. out:
  36. /*    j = max(i,j) -1*/
  37.     j= (j>i?j:i)-1;
  38.     for(i=1;i<=j;i++)
  39. /*    do 5 i=1,j*/
  40. /*    print*,odds(i),evens(i)*/
  41.     printf("%d %d\n",odds[i],evens[i]);
  42. /*5    continue*/
  43. /*    stop*/
  44. /*    end*/
  45. exit(0);
  46. }
  47.