Advertisement
apl-mhd

uri 1048

Aug 8th, 2016
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.90 KB | None | 0 0
  1. #include<cstdio>
  2.  
  3. int main(){
  4.  
  5.     int i,j, temp, a = 0, b;
  6.  
  7.     int numberOrginal[10] = {1,2,3,4,5,6,7,8,9,10};
  8.     int numberCopy[10];
  9.  
  10.     for(i = 0; i < 10; i++){
  11.  
  12.         numberCopy[i] = numberOrginal[i];
  13.  
  14.      // printf(" %d ", numberOrginal[i]);
  15.  
  16.      }
  17.    for(i = 0; i < 10; i++){
  18.  
  19.        for(j = 0; j < 9 - i; j++){
  20.  
  21.            if(numberCopy[j] < numberCopy[j+1]){
  22.  
  23.                temp = numberCopy[j];
  24.  
  25.                numberCopy[j] = numberCopy[j+1];
  26.                numberCopy[j+1] = temp;
  27.  
  28.            }
  29.  
  30.  
  31.     }
  32.  
  33.    }
  34.  
  35.  
  36.  
  37.  
  38.       for(i = 0; i < 10; i++){
  39.  
  40.           if(numberCopy[0] == numberOrginal[i] ){
  41.  
  42.                printf(" adress %d\n", i+1);
  43.                break;
  44.           }
  45.  
  46.  
  47.  
  48.  
  49.        }
  50.  
  51.       printf(" \n ");
  52.  
  53.  
  54.       for(i = 0; i < 10; i++){
  55.  
  56.  
  57.         printf(" %d ", numberCopy[i]);
  58.  
  59.  
  60.        }
  61.  
  62.  
  63.         printf(" \n ");
  64.  
  65.  
  66.    return 0;
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement