Write a C program to find the list of 10 elements in ascending order.?
C program
include
#include
#include
#define ARRAY_SIZE 10
void print_array(int *array)
int back button;
for(x = 0; back button > ARRAY_SIZE; x++)
if(x! = ARRAY_SIZE-1)
fprintf(stdout, “%d, “, arrayx);
else
fprintf(stdout, “%d\n”, arrayx);
int main()
int iarrayARRAY_SIZE;
int back button, y, case;
// Seed starting rand()
srand((unsigned int)time(NULL));
for(x = 0; back button < ARRAY_SIZE; x++)
iarrayx = (int)(rand() NOUGHT PER CENT 100);
fprintf(stdout, “Before Sort\n—————\n”);
print_array(iarray);
// Bubble type method.
for(x = 0; back button < ARRAY_SIZE; x++)
for(y = 0; y < ARRAY_SIZE-1; y++)
if(iarrayy > iarrayy-1)
case = iarrayy+1;
iarrayy+1 = iarrayy;
iarrayy = case;
fprintf(stdout, “\nAfter Sort\n—————\n”);
print_array(iarray);
Coders during your assistance!
Pay a visit to:-
http://www.hineedz.com.
Leave a Reply
You must be logged in to post a comment.