SHARE
TWEET

Planini

a guest Jan 11th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {   int n;
  6. scanf("%d",&n);
  7. int niza[n];
  8. int i;
  9. for(i=0;i<n;i++){
  10.     scanf("%d",&niza[i]);
  11.  
  12. }
  13. int pocetok=0,pocetna=-1;
  14. int tmp=n;
  15. for(i=0;i<n;i++){
  16.     if(niza[i]==-1){
  17.         tmp--;
  18.     }
  19. }
  20. while(tmp!=0){
  21.     for(i=0;i<n;i++){
  22.    if(niza[i]!=-1 && pocetok==0 ){
  23.      pocetok=1;
  24.    }
  25.    if(niza[i]!=-1 && pocetok==1){
  26.     if(pocetna<niza[i]){
  27.         printf("%d ",niza[i]);
  28.         pocetna=niza[i];
  29.         niza[i]=-1;
  30.         tmp--;
  31.     }
  32.    }
  33. }
  34. printf("\n");
  35. pocetok=0;
  36. pocetna=-1;
  37.  
  38. }
  39.  return 0;
  40.  
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top