程序:
#include<stdio.h>
int main(){
int a[10]={0},b= 0,T = 0;
for (int i = 0; i < 10; i++)
{
printf("请输入第%d个数\n",i);
scanf("%d",&a[i]);
}
printf("请输入X:\n");
scanf("%d",&b);
for (int i = 0; i < 10; i++)
{
if(a[i]==b){
T = i;
}
}
if(T){
printf("%d在数组的第%d",b,T);
}else{
printf("no found");
}
return 0;
}
日期: 2021-12-8