Find the index of the specified value in the array

#include<stdio.h>

void main()
{ int a[10]={0,1,2,3,4,5,6,7,8,9},i,t; scanf("%d",&t); for(i =0;i<=9;i++) if(a[i]==t) break; if(i>=10) printf("not found!\n"); else printf("found! The subscript is =%d\n”,i); }









Guess you like

Origin blog.csdn.net/qq_41661800/article/details/81534356