Login
Immutable PageDiscussionInfoAttachments
Diff for "rei05/C言語"

MMA
Differences between revisions 26 and 27
Revision 26 as of 2012-05-29 16:57:35
Size: 882
Editor: rei05
Comment:
Revision 27 as of 2012-05-30 23:23:11
Size: 1026
Editor: rei05
Comment:
Deletions are marked like this. Additions are marked like this.
Line 21: Line 21:



 * [[/Discussion]]
  * わざわざ1ページ作っての説明ありがとうございます。参考にさせていただきます。

C言語

AOJ解答

Help Me!

未解決

   1 #include<stdio.h>
   2 int main(){
   3 
   4 int n,i,j,k,l,temp;
   5 scanf("%d",&n);
   6 
   7 int num[n];
   8 for(i=0;i<n;i++){
   9   scanf("%d",&num[i]);
  10 }
  11 
  12 for(j=0;j<n;j++){
  13   for(k=0;k<j;k++){
  14     if(num[j]<num[k]){
  15       temp=num[j];
  16       num[j]=num[k];
  17       num[k]=temp;
  18     }
  19   }
  20 }
  21 
  22 for(l=0;l<n-1;l++){
  23   printf("%d ",num[l]);
  24 }
  25 printf("%d\n",num[n-1]);
  26 
  27 return(0);
  28 }

rei05/C言語 (last edited 2012-07-16 17:50:37 by nomeaning)