#include "stdio.h"
#include "conio.h"
#include "alloc.h"
#define TRUE 1
#define FALSE 0
void main()
{
int *a1,*a2,*a3,i,j,size=0,repeated,num;
clrscr();
printf("How Many Numbers? ");
scanf("%d",&num);
a1=(int *) malloc(num*sizeof(int));
a2=(int *) malloc(num*sizeof(int));
a3=(int *) malloc(num*sizeof(int));
printf("\nEnter %d Numbers:\n",num);
for(i=0;i
scanf("%d",&a1[i]);
/* Copying the elements of array a1 to another array a2 */
a2[i]=a1[i];
repeated=FALSE;
for(j=0;j
if(a1[i]==a2[j])
{
repeated=TRUE;
break;
}
if(!repeated)
a3[size++]=a1[i];
}
printf("\nRepeated Numbers Excluded.");
printf("\nPrinting Third Array...\n");
for(i=0;i
free(a1);
free(a2);
free(a3);
getch();
}
Friday, June 26, 2009
PROGRAM TO EXCLUDE THE REPEATED ELEMENTS FROM AN ARRAY
Labels: Arrays, Loops, Nice Programs
Posted by Unknown at 12:48 AM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment