Source Code
#include <stdio.h>
#include <stdlib.h>
void swapValue (int *tIntA, int *tIntB);
int main()
{
int tListAngka[20] = {9,9,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2};
int tSwap;
int tUrutan;
do {
tSwap = 0;
for(tUrutan=0;tUrutan<19;tUrutan++)
{
if(tListAngka[tUrutan]<tListAngka[tUrutan+1])
{
swapValue(&tListAngka[tUrutan], &tListAngka[tUrutan+1]);
tSwap = 1;
}
}
}
while(tSwap == 1);
for(tUrutan=0;tUrutan<20;tUrutan++)
{
printf("Nilai : %d,\n", tListAngka[tUrutan]);
}
system("pause");
}
void swapValue (int *tIntA, int *tIntB)
{
int tInt = *tIntA;
*tIntA = *tIntB;
*tIntB = tInt;
}
Terima Kasih ^_^
No comments:
Post a Comment