我的第六个代码

我的第六个代码

#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>

int main()
{
int arr[] = { 1, 2, 3, 4, 5, 1, 2, 3, 4 };
int i = 0;
int sz = sizeof(arr) / sizeof(arr[0]);

for (i = 0; i < sz; i++)
{
    int count = 0;
    int j = 0;
    for (j = 0; j < sz; j++)
    {
        if (arr[i] == arr[j])
        {
            count++;
        }
    }
    if (count == 1)
    {
        printf("单生狗是:%d\n", arr[i]);
        break;
    }
}

return 0;

}

//寻找一组数中出现次数为一的那个数

猜你喜欢

转载自blog.51cto.com/15100722/2625439