hi,
i wrote this program using if. Anyone can write it with while? i mean using while for sort function.
I tested follwing program n it is correct 100%. so i decided to share it with you and hope this will help those who learn c programming
i wrote this program using if. Anyone can write it with while? i mean using while for sort function.
I tested follwing program n it is correct 100%. so i decided to share it with you and hope this will help those who learn c programming
#include<stdio.h>
#include<conio.h>
# define n 10
int u[n];
void input();
void sort();
void print();
void main()
{
clrscr();
input();
sort();
print();
getch();
}
void input()
{
int i ;
for(i=0 ;i<n;i++)
{
printf("\n Input data to array position %d : ",i+1);
scanf("\n %d",&u);
}
}
void sort()
{
int i,temp,j;
for(i=1 ;i<n;i++)
{
temp = u;
j=i-1;
while(j>=0)
{
if (temp<=u[j] )
{
u[j+1]=u[j];
u[j]=temp;
}
j=j-1;
}
}
}
void print()
{
int i;
for(i=0 ; i<n ;i++)
printf("\n %d",u);
}

.. Arrary Programming 
hehe
kamali