#include
#include
#include
int x,y[5],i,temp,k;
int main(void)
{
srand(time(NULL));
for (i=1;i<=5;i++)
{
printf("%d\n",x=rand()%10);
y[i]=x;
}
printf("\n\n");
for (i=1;i<=5;i++)
{
for (k=i;k<=5;k++)
{
if (y[i]>y[k])
{
temp=y[i];
y[i]=y[k];
y[k]=temp;
}
}
}
for (i=1;i<=5;i++)
{
printf("%d\n",y[i]);
}
return(0);
}
Output Random Numbers
Posted by acas arnel m. at 12:39 AM
Labels: C language codes
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment