Saturday, August 18, 2018

ARRAY: PROGRAM TO FIND OUT THE REPEATED ELEMENT IN AN ARRAY

#include<stdio.h>
void main()
{
int arr[5],i,f=0,j;
printf("Enter the array element:");
for(i=0;i<5;i++)
{
scanf("%d",&arr[i]);
}
for(i=0;i<5;i++)
{
for(j=i+1;j<5;j++)
{
if(arr[i]==arr[j])
{
printf("The element %d is repeated in array\n",arr[i]);
f=1;
break;
}
}
}
if(f==0)
printf("No element in an array is repeated");
}

OUTPUT:

No comments:

Post a Comment

Static Member Function

CODE : #include<iostream> using namespace std; class test  {     int code;       static int count;               //static...