Home   Easy-Code    Forum  Updater 
Twitter Facebook



Program on array manupulations using c

Critics Rating:

Users Rating:

       /* PROGRAM ON ARRAY MANUPULATIONS */

#include <stdio.h>

main()

{

int a[20],b[20],n,i,j,temp,sb,ss,sbp,ssp;

clrscr();

printf("ENTER HOW MANY ELEMENTS\n");

scanf("%d",&n);

printf("ENTER %d ELEMENTS\n",n);

for (i=0;i
scanf("%d",&a[i]);

for (i=0;i
b[i]=a[i];

for (i=0;i
{

for (j=i+1;j
if (a[i]
{

   temp=a[i];

   a[i]=a[j];

   a[j]=temp;

}

}

sb=a[1];

ss=a[n-2];

for (i=0;i
{

for (j=i+1;j
{

if (b[i]==sb)

   sbp=i;

if (b[i]==ss)

   ssp=i;

}

}

b[sbp]=ss;

b[ssp]=sb;

printf("AFTER INTERCHANGING THE SECOND BIGGEST ELEMENT AND\n");

printf("THE SECOND SMALLEST ELEMENT THE ARRAY IS\n");

for (i=0;i
printf("%d\n",b[i]);

getch();

}



Courtesy, Source, References & Regards: Kishore AVGK

While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright@2009-2011 by KuGuNi.com. All Rights Reserved.