华为面试题
发布网友
发布时间:2022-04-20 11:00
我来回答
共5个回答
热心网友
时间:2023-09-07 00:13
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
int main(int argc, char* argv[])
{
while(1)
{
unsigned int nInt = 0;
scanf("%d",&nInt);
if(0 == nInt)
break;
char szDigit[32];
memset(szDigit,0,sizeof(szDigit));
unsigned int nIntT = nInt;
int nCount = 0;
while(nIntT > 0 && nCount < sizeof(szDigit) - 1)
{
szDigit[nCount] = nIntT % 10;
nIntT /= 10;
nCount++;
}
bool bRel = true;
for(int i = 0; i<nCount/2;i++)
{
if(szDigit[i] != szDigit[nCount - i - 1])
bRel = false;
}
if(bRel)
printf("%d is Y\n",nInt);
else
printf("%d is N\n",nInt);
}
system("pause");
return 0;
}
热心网友
时间:2023-09-07 00:14
4.struct为关键字,是定意结构体的意思
6.全局变量,全局有效,局部变量,该函数内有效
8.16位
热心网友
时间:2023-09-07 00:14
这就是华为面试的题目吗?是什么职位的啊?
4.struct为关键字,是定意结构体的意思
6.全局变量,全局有效,局部变量,该函数内有效
8.16位
热心网友
时间:2023-09-07 00:15
#include
<stdio.h>
#include
<stdlib.h>
#include
<memory.h>
int
main(int
argc,
char*
argv[])
{
while(1)
{
unsigned
int
nInt
=
0;
scanf("%d",&nInt);
if(0
==
nInt)
break;
char
szDigit[32];
memset(szDigit,0,sizeof(szDigit));
unsigned
int
nIntT
=
nInt;
int
nCount
=
0;
while(nIntT
>
0
&&
nCount
<
sizeof(szDigit)
-
1)
{
szDigit[nCount]
=
nIntT
%
10;
nIntT
/=
10;
nCount++;
}
bool
bRel
=
true;
for(int
i
=
0;
i<nCount/2;i++)
{
if(szDigit[i]
!=
szDigit[nCount
-
i
-
1])
bRel
=
false;
}
if(bRel)
printf("%d
is
Y\n",nInt);
else
printf("%d
is
N\n",nInt);
}
system("pause");
return
0;
}
热心网友
时间:2023-09-07 00:15
1
一个
2
8