Advertisement

You’ve to enter number , then you have to find a number & how many time(s) it found:::


#include<stdio.h>
#include<conio.h>
void main()
{ clrscr();
  int a[100],i,j=0,n,m;
  printf("Enter how many number you want to input=");
  scanf("%d",&n);
  printf("\nEnter the number of same number students=");
  for(i=0;i<n;i++)
 {scanf("%d",&a[i]);}
  printf("\nEnter a number for search=");
  scanf("%d",&m);
  for(i=0;i<n;i++)

  {if(m==a[i])
  {   j++;   } }

    if(j==0)
  {  printf("search result empty");   }
  else
  {  printf("match found=%d times",j);   }

  getch();
}

No comments:

Post a Comment

Please comment bellow. Share your knowledge