Draw a flow chart and write a program in C to sort a given list of numbers. 7m Jun2007
Flowchart:
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();
}
[codesyntax lang=”c”]
#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(); }
[/codesyntax]
Screen Shots:
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