here are some of the things which i think un wanted
Code:
#include <stdio.h>
int main([color]int argc, char *argv[][/color])
{
int index;
int array[8]; /*this array has 8 integers*/
for(index = 0; index < 8; index++)
{
printf("Enter eight intergers to be sorted.\n");
scanf("%d", array[index]); /*get integers from user*/
}
[color]}[/color]
[color]{[/color]
int array[8]; /*identifies the array*/
int i, j, k, x;
for(i = 0; i < 8; i++)
{
if (array[i] > array[j])
{
x = array[i];
array[i] = array[j];
array[j] = x;
}
}
for(k = 0; k < 8; k++)
{
printf("%d", array[k]);
printf("\n");
}
return 0;
}
and here is the working programe
Code:
#include <stdio.h>
int main()
{
int index;
int array[8]; /*this array has 8 integers*/
int i, j, k, x;
printf("Enter eight intergers to be sorted.\n");
for(index = 0; index < 8; index++)
{
scanf("%d", &array[index]); /*get integers from user*/
}
for(i = 0; i < 8-1; i++)
{
for(j=i+1;j<8;j++)
if (array[i] > array[j])
{
x = array[i];
array[i] = array[j];
array[j] = x;
}
}
for(k = 0; k < 8; k++)
{
printf("%d\t", array[k]);
printf("\n");
}
getchar();
return 0;
}
s.s.harish