
Posted On: Feb 22, 2018
C program to remove duplicate programme:
#include <stdio.h>
int main(){
int n, a[100], b[100], calc = 0, i, j;
printf("Enter no. of elements in array\n");
scanf("%d", &n);
printf("Enter %d integers\n", n);
for (i = 0; i < n; i++)
scanf("%d", &a[i]);
for (i = 0; i<n; i++) {
for (j = 0; j < calc; j++) {
if(a[i] == b[j])
break; }
if (j== calc){
b[count] = a[i];
calc++; } }
printf("Array obtained after removing duplicate elements:\n");
for (i = 0; i < calc; i++)
printf("%d\n", b[i]);
return 0;}
Never Miss an Articles from us.
C defines another class of variables called static variables. Static variables are of two types:Static variables tha..
The scope resolution operator (::) is useful in C programming when both global and local variables have the same name,..
C language allows the use of the prefix register in primitive variable declarations. Such variables are called register..