Advertisement
Bensallam

Untitled

Jun 28th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.83 KB | None | 0 0
  1. /*
  2.  ============================================================================
  3.  Name        : TriParPosition.c
  4.  Author      : abdou
  5.  Version     :
  6.  Copyright   : Your copyright notice
  7.  Description : Hello World in C, Ansi-style
  8.  ============================================================================
  9.  */
  10.  
  11. #include <stdio.h>
  12. #include <stdlib.h>
  13.  
  14. int T[5],P[5],R[5];
  15. short i,j,k,posit,h;
  16.  
  17. int main(void) {
  18.  
  19.     printf("Entrer des valeur: ");
  20.     for(i=0;i<5;i++){ scanf("%d",&T[i]);}
  21.  
  22.     j=0;
  23.     for(h=0;h<5;h++)
  24.     {
  25.         posit=0;
  26.         for(i=0;i<5;i++)
  27.         {
  28.             if(T[h] > T[i])
  29.             {
  30.                 posit=posit+1;
  31.             }
  32.         }
  33.         P[j]=posit;
  34.         j=j+1;
  35.     }
  36.     k=0;
  37.  
  38.     for(i=0;i<5;i++)
  39.     {
  40.         for(j=0;j<5;j++)
  41.         {
  42.             if(P[j]==i)
  43.             {
  44.                 R[k]=T[j];
  45.                 k=k+1;
  46.             }
  47.         }
  48.     }
  49.  
  50.     for(i=0;i<5;i++){printf("%d",R[i]);}
  51.  
  52.     return EXIT_SUCCESS;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement