Posts

Showing posts from September 15, 2012

PROGRAM TO SORT 10 ELEMENTS USING BUBBLE SORT

Image
#include<stdio.h>
#include<conio.h>
void main()
{
long int i,j,tmp,a[10];
for(i=0;i<n;i++)
printf("enter nos.\n");

for(i=0;i<10;i++)
scanf("%ld",&a[i]);

for(i=0;i<10;i++)
{
for(j=0;j<9;j++)
if(a[j]>a[j+1])
{
tmp=a[j];
a[j]=a[j+1];
a[j+1]=tmp;
}
}
printf("sorted array is -->\n");
for( i=0;i<10;i++)
printf("%ld\n",a[i]);
getch();
}

SIMPLE PROGRAMS FIND TYPE OF THE TRIANGLETEMPERATURE CONVERSIONCOMMISSION OF A SALESMANPRINT NUMBERS IN DESCENDING ORDERBIGGEST NUMBER AMONG THREE NUMBERSCALCULATE DIVISIONA YEAR IS LEAP OR NOTA NUMBER IS ODD OR EVEN PRINT THE SQUARE ROOT ELSE PRINT N TO THE POWER 5PRINT A NEW NUMBER BY ADDING 1 TO EACH DIGIT OF THE NUMBER PRINT THE NO. OF CURRENCY NOTES ACCORDING TO THE AMOUNT ENTEREDDATA STRUCTURES ENTER DETAILS OF A STUDENTENTER DETAILS OF A STUDENT USING STRUCTURE WITHIN A STRUCTURE

IMPORTANT EXAMPLES DIFFERENCE BETWEEN DIFFERENCE AND CONTINUEDIFFERENCE BETWEEN CALL BY REFERENCE AND C…

PROGRAM TO SORT AN ARRAY OF 10 ELEMENTS USING SELECTION SORT

Image
#include<stdio.h>
#include<conio.h>
void main()
{
long int i,j,small,tmp,pos,a[10];
clrscr();
printf("enter nos.\n");
for(i=0;i<10;i++)
scanf("%ld",&a[i]);

for(i=0;i<10;i++)
{ small=a[i];
  pos=i;
for(j=i+1;j<10;j++)
 {
if(a[j]<small)
  {
  small=a[j];
  pos=j;
 }
 }
tmp=a[i];
a[i]=a[pos];
a[pos]=tmp;
}
printf("sorted array is -->\n");
for( i=0;i<10;i++)
printf("%ld\n",a[i]);
getch();
}

SIMPLE PROGRAMS FIND TYPE OF THE TRIANGLETEMPERATURE CONVERSIONCOMMISSION OF A SALESMANPRINT NUMBERS IN DESCENDING ORDERBIGGEST NUMBER AMONG THREE NUMBERSCALCULATE DIVISIONA YEAR IS LEAP OR NOTA NUMBER IS ODD OR EVEN PRINT THE SQUARE ROOT ELSE PRINT N TO THE POWER 5PRINT A NEW NUMBER BY ADDING 1 TO EACH DIGIT OF THE NUMBER PRINT THE NO. OF CURRENCY NOTES ACCORDING TO THE AMOUNT ENTEREDDATA STRUCTURES ENTER DETAILS OF A STUDENTENTER DETAILS OF A STUDENT USING STRUCTURE WITHIN A STRUCTURE

IMPORTANT EXAMPLES DIFFERENCE BETWEEN DIFFERENCE…