0 like 0 dislike
6.6k views
請設計一程式,讓使用者輸入十個正整數,程式會將這十個數從小到大輸出。

Sample input:

5 3 1 6 4 8 9 7 2 2

Sample output:

1 2 2 3 4 5 6 7 8 9
[Exercise] Coding (C) - asked in 作業 by (18k points)
ID: 14583 - Available when: Unlimited - Due to: Unlimited
| 6.6k views

54 Answers

0 like 0 dislike
Hidden content!
#include<stdio.h>
** *** *** * * **** *

int main()

{
** ** ****** * ** i,num[10]={0},j,tmp;
***** * **** ****** **** *
**** ********** * * **** ***** *** * * *****
*** * * * * * * ***

{
* *** *** ** * ** *** ****

{
* * *** ** * *** * ** **

{
**** ** * ** * * ****
**** ** * ** *** ***
* ** **** ***

}

}
*** * * * * * *** ",num[j]);

}
** ** * * *** * 0;





}
answered by (937 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>
* ** ** ****** ** * *

int main()

{
* ** * ** * * ** ** i,num[10]={0},j,tmp;
* ** ** * * *** ******* * * * *
* * ** * *** ** * * ** ***** ** * ** *** **
* * * * * * *****

{
* *** ** *** * * * ** *

{
* * ******* ** ** * ** ** *****

{
* ** ** * * * * *
** * *** * ***** ** ** *
* *** * ** ** * * ** *

}

}
* ** * *** **** *** ** ***** ",num[j]);

}
** * ** * * * ***** 0;





}
answered by (-190 points)
0 like 0 dislike
Hidden content!
* * ***** *
* ** * * * * ** * *** *



int main()

{
* *** *** *** * ** * * i, j, tmp, * * **


* ********* * * ** ** * (i = 0; * 10; i++)
* * * *** * ** * * ** ** * * * ** ** ** ***** * * * * * *



for (j=0; j ** ** * 9; j++)
* * * ** * *** ** *** * (i = j+1; i 10; i++)

if (num[j] * num[i])

{
** ** ** * ** * * *** = num[j];
** * * * * * * = num[i];
*** **** **** ***** **** = tmp;

}
* ** ** * **** * *** * * (i = 0; i 10; i++)
** * * *** *** ** *** * ** * *** * * ** ** ** * ** **** ** *




******** * * *** ** * **** ** ** * ***
* ** * * * * 0;

}
answered by (56 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <stdlib.h>



int main()

{
* ** * ***** * * * * ** i, j, tmp;
*** * ** * * * ** num[10] = {0};
*** ** ** *** ** **** (i = 0; i < 10; i++)
** * * **** ***** ****** * *** ** ** * ** &num[i]);
* * *** * * ** **** (j = 0; j < 10; j++)

    {
*** ** *** ** ** ** * ** * * *** *** *** * * (i = j; i < 10; i++)
****** **** ** * ***** * * * * * ** * * ** *
** * *** **** * *** ** **** ** ** *** * *** ** * * * * ** * ** (num[j] < num[i])
** *** * * * ** * * *** * ** * * * **** * ** * * * * *
*** ** * * * ** * *** ** * *** * ** * * * * **** * *** ** ** * * * ** * ** * = num[i];
* *** **** ** ** * * ** ** ** * * **** ** * * **** * * * *** * * ** * **** * * = num[j];
** * ** ** ** * ** ** ** * * * **** ** ** * * ** * ** * *** * ** ** ** * * * ** ** ** = tmp;
** * * ***** ** ** ***** * *** * * ** *** ** *** * * **********
* * ** * ** * *** ** * ** * * * ** * * ** *
*** ** * ** * ** ** *** * * *** ** ** * ** * * * *** ", num[i]);
* * ** * ** **** * *


**** * * *** ** ***** **** * 0;

}
answered by (-214 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>
* ** * * * *

int main()

{
*** * ** * * ** ** ** i,num[10]={0},j,tmp;
* *** * ** ** *** * ** *******
* ** * * * *** *** **** ** * ** * * * * * * * *
* * ** ** * * * * *** ****

{
* *** ** ** * * **** * *

{
* ****** *** ***** ** * ***

{
* *** * *** * * ***
* * * * * ** ** ***
* ** * *** * * ** * *

}

}
* ********* ***** ***** * ** ",num[j]);

}
***** * *** *** *** **** 0;





}
answered by (-190 points)
0 like 0 dislike
Hidden content!
* ****** * **

int main ()

{

int i , ** ** **
** * ***
**** * *** ** **** ** ** ** *
***** * * *

{
*** ****** * * * *

{

if ** * ****
* *
** *
** ***

}
** ** *** * ** *

return 0;





}
answered by (-304 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <stdlib.h>

int main()

{

    int i,j, num[10]={0},tmp;
** * ** *** * *** ** ** ***
**** * * * * ** * ***** * * * * ** * * **** *
* ** *** * *** *** * * *    
* * * ***** *** * ** ** **********
* * **** *** * *** ** *** * ***** ** * * * *****
* * * * * ****** *** ** * ***** ** ** * * **
* ** ** * ** *** * ** ** ** * *** * * ** = num[j];
* * * * ** *** ***** * *** ** *** ***** ** = num[i];
*** ** ** * * *** * **** ** * ** ** * * * * = tmp;
* ** * ** *** ** * * * ** ** * *** *** * *

* * ** ** **** ***** ** * * * * **** *
** * * * ** * ** ** * **** * **
* ** * * **** * **** ***** * * * * * ",num[i]);
* ** ***** * ** * * * ** * **** ** ** ** *
* * * * ** ******* * ** * 0;

}
answered by (-284 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>
** * * ** **

int main()

{
* * ** ** * * * i,num[10]={0},j,tmp;
* * * *** ** ***** * * ** * *
*** ** * ** ** ** ** ** ****** * ** ***
***** ** *** * * * * *** *

{
* * ** * *** ** ****** * *

{
* * * ** * ** * ***** * * ***

{
* * * * **** * **** *
* ******** * *** *
***** ** * * *** *

}

}
* * *** ** *** * ** **** ***** ",num[j]);

}
* ** * ** * ** *** *** 0;





}
answered by (-190 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <stdlib.h>



int main()

{
* * * ** * ** ***** i, j, tmp;
*** * ** ** *** *** *** * num[10] = {0};
* ** * * *** * * ** * ** (i = 0; i < 10; i++)
***** ** * * * * ** **** **** ***** * *** ** ** * **** ** * &num[i]);
* * ** ** * * ** * * * (j = 0; j < 10; j++)

    {
** *** **** * * ** * * ** * ****** * ****** * (i = j; i < 10; i++)
* ***** * * * * * * * * * *** *** * * **
** * * * ** * * ******* ** **** ***** ** ** **** *** *** ** * (num[j] >= num[i])
** **** * *** * ** ****** *** * ** * ** * * ** * * * * ***** **** ** ****** *
* * *** ** ** * * ** * * ** * * ** ** * * * * * ** ** * * * * * * ** ** ** ** * ** = num[i];
** * * **** * ***** * * ***** *** * ** *** * * ******** *** ** * * * * *** * * * * * ** = num[j];
* ***** *** *** ** **** * ** ** * * * ** **** * ** *** * ***** ** * * * ** * * * * **** ** = tmp;
* * * * * ** * **** **** ** * * ** **** ****** ** *** * ** **** **
*** *** * ** ** * * ** * * * ** *****
* * * * ** ** *** * * * * * *** * ** * * *** ** * * ", num[i]);

    }
* * * **** ** *** * * ****** * * *


** * * * * * ** *** * 0;

}
answered by (-214 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<stdlib.h>

int main()

{

    int motherfucker=0;

    int i=0;

    int j=0;

    int asshole[10];
*** * *** * * * * * * ** ** *
** **** ***** * * ******* ****** * * * * *
** ********* ** ***** * ** ** ** * ** * *** ** * * **** * ** ** * ** * * *** * ****** ****
** * ** *** *** *** ***** * * ** ****** *
**** * * * ** * * * * ** *

    {
** * * *** ** * * * * *** ** * ******* * * *
* * * ** * ** * ******* * *** * * ** **
* * **** **** **** * *** ** ** *** * ** *** ** * * * * ** *** * * *** *** *
***** ** * ** * * * **** ** * * * * * ** ** ** * ***** ** **** * * * *
*** ** * * **** * * * * * ** * * *** * * * * *** *** ***** * *** * * * ** *** * * * *** * ****
* * ** * * * * ** *** * * ** * * * ***** ** **** * ** ******* *** * ***** *** ** * *** **
**** ***** ** ***** * * * **** *** * * * *** * * * * ** ** * *** ** ** *** * * ** ** ** * *
**** * *** * ** ** * * ** *** * * *** * * **** ** ** * ** ** ***
* ** * * * * *** ** ** * ** ***

    }
*** ****** *** ** * * * *** * ***
* * * * * * * * ** * * ** ",asshole[j]);
* *** *** * * **** * ** * *** * * * ** * ** * ** ** * ** ** * * * * * * ** * *** ** ** * * * * * *** ***** * * * * *** * *

    return 0;

}
answered by (-90 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.131.202
©2016-2025

Related questions

0 like 0 dislike
31 answers
[Exercise] Coding (C) - asked Oct 20, 2016 in 作業 by Shun-Po (18k points)
ID: 14582 - Available when: Unlimited - Due to: Unlimited
| 4.2k views
0 like 0 dislike
37 answers
[Exercise] Coding (C) - asked Oct 20, 2016 in 作業 by Shun-Po (18k points)
ID: 14579 - Available when: Unlimited - Due to: Unlimited
| 4.7k views
0 like 0 dislike
37 answers
[Exercise] Coding (C) - asked Oct 20, 2016 in 作業 by Shun-Po (18k points)
ID: 14581 - Available when: Unlimited - Due to: Unlimited
| 5.3k views
0 like 0 dislike
23 answers
[Exercise] Coding (C) - asked Oct 13, 2016 in 作業 by Shun-Po (18k points)
ID: 13528 - Available when: Unlimited - Due to: Unlimited
| 3.6k views
0 like 0 dislike
31 answers
[Exercise] Essay (Open question) - asked Nov 3, 2016 in 作業 by Shun-Po (18k points)
ID: 16958 - Available when: Unlimited - Due to: Unlimited
| 4.5k views
12,783 questions
183,442 answers
172,219 comments
4,824 users