Mukesh and Salima was looking to buy Organic Apples in the nearest fruits shop.But Shop Owner mixed the Hybrid apples in that Apple box. After sometimes Mukesh checking the box, he was confused among organic and hybrid apple. He started to count the hybrid apples. Please help to Mukesh Count the total number of hybrid apples in the box.
#include <stdio.h>
#include<string.h>
int main()
{int numofapples ,x,i,c=0;
scanf("%d",&numofapples);
int arr[100]={0};
for(i=0;i<numofapples;++i){
scanf("%d",&x);
arr[x]++;
}
for(i=0;i<100;++i){
if(arr[i]>1)c+=(arr[i]-1);
}
printf("%d",c);
return 0;
}
Comments
Post a Comment