#include<stdio.h>
#include<stdlib.h>
void shuzhu1(int a[],int n)//找出数组中第一次出现只1次的数
{
	int i,c=0;
	for(i=0;i<n;i++)
	{
		for(int j=i;j<n;j++)
		{
			if(a[i]==a[j])
			{
				c++;
			}
		}
		if(c==1)
		{
			printf("%d",a[i]);
			break;
		}
		else
		{
			c=0;
		}
	}
}

void shuzhu2(int a[],int n)//找出出现最多次数的数
{
	int i,c=0;
	int count=0;
	int max;
	for(i=0;i<n;i++)
	{
		for(int j=i;j<n;j++)
		{
			if(a[i]==a[j])
			{
				count++;
			}
		}
		if(count>c)
		{
			c=count;
			count=0;
			//break;
			max=a[i];
		}
		else
		{
			count=0;

		}
	}
	printf("%d",max);
}
int main()
{
	int a[12]={2,8,6,5,4,2,1,86,5,8,8,1};
	shuzhu2(a,12);
}


相关文章:

  • 2022-01-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-15
  • 2022-01-17
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-26
  • 2022-12-23
  • 2021-11-18
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案