Here is code.. i coded for sorting a 1-Dimeinsional Array of Integers..
Code:
# include %26lt;stdio.h%26gt;
# include %26lt;conio.h%26gt;
# include %26lt;alloc.h%26gt;
# define MAX 5
void main()
{
int *ary, i, j, temp;
clrscr();
ary = (int *) malloc (MAX * sizeof(int));
printf("\n Please enter the elements one by one...\n");
for(i=0; i%26lt;MAX; i++)
{
printf("\n Element No %d: ", i+1);
scanf("%d", ary+i);
}
for(i=0; i%26lt;MAX-1; i++)
for(j=i+1; j%26lt;MAX; j++)
{
if(*(ary+i) %26gt; *(ary+j))
{
temp = *(ary+i);
*(ary+i) = *(ary+j);
*(ary+j) = temp;
}
}
printf("\n The sorted array is as follows... ");
for(i=0; i%26lt;MAX; i++)
printf("%d ", *(ary+i));
getch();
}
Compilation Instructions:
Press F7 to compile...
If zero Errors, then proceed...
Press CTRL+F9 to Execute the program...
Give me an example of software program using turbo c.?
many pharmacy companies are using C, Turbo C, C++ as a basis to test drugs on a "human" computer, before testing them anywhere else.
Reply:#include %26lt;stdio.h%26gt;
#include%26lt;conio.h%26gt;
void main()
{
printf("my name is AMIT"); //print name of screen
getch();
}
it is simple program which will print name on screen all its need is compile on turboc and run
Reply:Search the internet - it'll be quicker than waiting for an answer here.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment