Draw a flow chart and write a program in C to sort a given list of numbers. 7m Jun2007

By | July 10, 2014

Draw a flow chart and write a program in C to sort a given list of numbers. 7m Jun2007

 

Flowchart:

FlowChart_Sort_List

Code:

#include<stdio.h>

void main()
{
int I,J,Temp,List[]={6,3,0,4,8,2,5,9,1,7};
clrscr();
printf(“List Before Sorting :\n”);
for(J=0;J<10;J++)
{
printf(“%d “,List[J]);
}
for(I=0;I<10;I++)
{
for(J=0;J<=I;J++)
{
if(List[J]>List[I])
{ Temp=List[I];
List[I]=List[J];
List[J]=Temp;
}
}
}
printf(“\nList Before Sorting :\n”);
for(J=0;J<10;J++)
{
printf(“%d “,List[J]);
}
getch();
}

#include<stdio.h>
void main()
{
int I,J,Temp,List[]={6,3,0,4,8,2,5,9,1,7};
clrscr();
printf("List Before Sorting :\n");
for(J=0;J<10;J++)
{
printf("%d ",List[J]);
}
for(I=0;I<10;I++)
{
for(J=0;J<=I;J++)
{
if(List[J]>List[I])
{ Temp=List[I];
List[I]=List[J];
List[J]=Temp;
}
}
}
printf("\nList Before Sorting :\n");
for(J=0;J<10;J++)
{
printf("%d ",List[J]);
}
getch();
}

 Screen Shots:

C_program_Sort_Bubble

C_program_Sort_Bubble_Output

Write a program in C to cornpare two strings without using String Compare function. 5m Jun2007

Solved program can be found on this link http://cssimplified.com/c-programming/write-a-program-that-does-not-use-the-inbuilt-string-functions-to-perform-the-following-10m-jun2006

Leave a Reply