# Problem 3

### 31 comments on “Problem 3”

• ashish.pahariya73

arr = input().split()
input =int(input())
counter = 0
for num in arr:
if input == int(num):
counter+=1
print(counter)

• Mangalam

array=[]
n=int(input(‘length of the array’))
for i in range(0,n):
item=int(input())
array.append(item)
x=int(input(‘enter the number whose frequency is to be found’))
count=0
for i in range(0,n):
if array[i]==x:
count=count+1
print(count)

• Mandeep

#include
using namespace std;

int main() {
int i ,a[50],n,count=0,x;
cout<>n;
cout<<"Element of array : \n";
for(i=0;i>a[i];
}
cout<>x;
for(i=0;i<n;i++)
{

if(x==a[i])
{
count++;
}
}
cout<<"\n Count : "<<count;

return 0;
}

• Anshul

list=[1, 1, 2, 2, 2, 2, 3]
n = len(list)

count = 0
p = int(input(“Enter number to be searched: \n”))
for i in range(n):
if p == list[i]:
count += 1

print(“The count is”,count)

• dee.pansh18johri

#include
using namespace std;

int main() {

int n;
cin>>n;
map s;
for(int i=0;i>e;
s[e]++;
}
int x;
cin>>x;
cout<<s[x];

return 0;
}
DEEPANSH JOHRI

#include
using namespace std;

int main()
{

int n;
cin>>n;
vectorv(n);
for(int i=0;i>v[i];
}
int t;
cin>>t;
int l=lower_bound(v.begin(),v.end(),t)-v.begin();
int u=upper_bound(v.begin(),v.end(),t)-v.begin();
cout<<(l-u==0?-1:(u-l))<<"\n";
return 0;
}

• HEMAPRAKASH

#include

void repeat(int a[],int n,int x)
{
int k=0,i;
for(i=0;i<n;i++)
{
if(a[i]==x)
k++;
}
printf("%d",k);
}

int main()
{
int i,a[100],n,x;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
scanf("%d",&x);
repeat(a,n,x);
}