write a program to check the repetition of a number and find its position .
#include<stdio.h>
#include<conio.h>
int main()
{
int a[100],i,n,val,c=0;
printf("enter the size of an array\n");
scanf("%d",&n);
printf("enter the element in aaray\n");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
printf("enter the value for search\n");
scanf("%d",&val);
for(i=0;i<n;i++)
{
if(val==a[i])
{
c++;
printf("value lies at position n%d\n",i++);
}
}
if(c==0)
printf("value does not found\n");
else
printf("value lies %d times",c);
return 0;
}
Comments
Post a Comment