#include
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();
}
Showing posts with label array manipulations in C. Show all posts
Showing posts with label array manipulations in C. Show all posts
Program on array manipulations using c, array manipulations in C, C array manupulations
Program on array manipulations using c, array manipulations in C
C Program on array manipulations
array manipulations in C , C Assignment array manipulations
#include
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<n;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();
}
Related Links :
Subscribe to:
Posts (Atom)
If you face any Problem in viewing code such as Incomplete "For Loops" or "Incorrect greater than or smaller" than equal to signs then please collect from My Web Site CLICK HERE
|
More Useful Topics... |
|
History Of C..
In the beginning was Charles Babbage and his Analytical Engine, a machine
he built in 1822 that could be programmed to carry out different computations.
Move forward more than 100 years, where the U.S. government in
1942 used concepts from Babbage’s engine to create the ENIAC, the first
modern computer.
Meanwhile, over at the AT&T Bell Labs, in 1972 Dennis Ritchie was working
with two languages: B (for Bell) and BCPL (Basic Combined Programming
Language). Inspired by Pascal, Mr. Ritchie developed the C programming
language.
he built in 1822 that could be programmed to carry out different computations.
Move forward more than 100 years, where the U.S. government in
1942 used concepts from Babbage’s engine to create the ENIAC, the first
modern computer.
Meanwhile, over at the AT&T Bell Labs, in 1972 Dennis Ritchie was working
with two languages: B (for Bell) and BCPL (Basic Combined Programming
Language). Inspired by Pascal, Mr. Ritchie developed the C programming
language.
My 1st Program...
#include
#include
void main ()
{
clrscr ();
printf ("\n\n\n\n");
printf ("\t\t\t\"Life is Good...\"\n");
printf ("\t\t\t********************************");
getch ();
}
Next Step...
#include
#include
void main ()
{
clrscr ();
printf ("\n\n\n\n\n\n\n\n");
printf ("\t\t\t --------------------------- \n\n");
printf ("\t\t\t | IGCT, Info Computers, INDIA | \n\n");
printf ("\t\t\t --------------------------- ");
}

