Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int count=0,value,i;
- int arr[5];
- for(i=0; i<5;i++)
- {
- scanf("%d",&arr[i]);
- //printf("\n%d",arr[i]);
- }
- scanf("%d",&value);
- for(i=0;i<5;i++)
- {
- if(value==arr[i])
- {
- count++;
- }
- }
- if(count==0)
- {
- printf("Not found");
- }
- else
- printf("%d",count);
- return 0;}
- ALTERNATE
- #include<stdio.h>
- int main()
- {
- int count=0,value,i;
- int arr[10];
- for(i=0; i<10;i++)
- {
- scanf("%d",&arr[i]);
- //printf("\n%d",arr[i]);
- }
- scanf("%d",&value);
- for(i=0;i<10;i++)
- {
- if(value==arr[i])
- {
- count++;
- }
- }
- if(count!=0)
- {
- printf("%d",count); }
- else
- printf("Not found");
- return 0;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement