C语言小程序哪里错了?一运行就停止了
#include<stdio.h>intmain(void){longn,j,i;longa[1000000];while(scanf("%ld",&n)&&n!=0){...
# include <stdio.h>
int main(void)
{
long n,j,i;
long a[1000000];
while(scanf("%ld",&n) && n != 0)
{
for(i=0; i<n; ++i)
{
scanf("%ld",&a[i]);
}
for(i=0; i<n-1; ++i)
{
for(j=i+1; j<n; ++j)
{
if(a[i] == a[j])
break;
}
if(j == n)
break;
}
printf("%ld\n",a[i]);
}
return 0;
} 展开
int main(void)
{
long n,j,i;
long a[1000000];
while(scanf("%ld",&n) && n != 0)
{
for(i=0; i<n; ++i)
{
scanf("%ld",&a[i]);
}
for(i=0; i<n-1; ++i)
{
for(j=i+1; j<n; ++j)
{
if(a[i] == a[j])
break;
}
if(j == n)
break;
}
printf("%ld\n",a[i]);
}
return 0;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询