PROGRAM-25


// Program of bubble sorting
#include
#include
void main()
{
  clrscr();
  int i,a[30],n,j,temp;
  printf("Enter the number of array: ");
  scanf("%d", &n);
  for(i=1;i<=n;i++)
 {
  printf("Enter the element of array = ");
  scanf("%d", &a[i]);
 }
 for(i=1;i<=n;i++)
 {
  for(j=1;j<=n-1;j++)
 {
  if(a[j]>a[j+1])
 {
  temp=a[j];
  a[j]=a[j+1];
  a[j+1]=temp;
 }
 }
 }
 for(i=1;i<=n;i++)
{
 printf("a[%d] = %d,",i,a[i]);
}
 getch();
}
 
Algorithm
·                     Start
·                     Declare i, a[30], n, j, temp as integer
·                     Write("the number of array")
·                     Read(“the number of array”)
·                     for(i=1;i<=n;i++)
·                     Write("the element of array")
·                     Read(“the element of array”)
·                      for(i=1;i<=n;i++)
·                     for(j=1;j<=n-1;j++)
·                     if(a[j]>a[j+1])
·                     temp=a[j]
·                     a[j]=a[j+1]
·                     a[j+1]=temp
·                     for(i=1;i<=n;i++)
·                     Read(“I and a[i]”)
·                     Stop

#vpsinghrajput

Author & Editor

Has laoreet percipitur ad. Vide interesset in mei, no his legimus verterem. Et nostrum imperdiet appellantur usu, mnesarchum referrentur id vim.

1 comments: