码迷,mamicode.com
首页 > 编程语言 > 详细

Problem C: 零起点学算法82——数组中查找数

时间:2018-11-09 22:03:54      阅读:423      评论:0      收藏:0      [点我收藏+]

标签:alt   line   scan   int   ++   else   class   eof   string   

#include <stdio.h>

int main(int argc, char *argv[])
{
    int n,b,i,m,flag=0,a[20];
    while(scanf("%d",&n)!=EOF){
        for(i=0;i<n;i++){
            scanf("%d",&a[i]);
        }
        scanf("%d",&m);
        for(i=0;i<n;i++){
        if(a[i]==m){
            b=i;
            flag=1;
            break;
         }
        }
        if(flag==1){
        printf("%d\n",b);
        }
        else{
        printf("No\n");
        }
        flag=0;
    }
    return 0;
}

Problem C: 零起点学算法82——数组中查找数

标签:alt   line   scan   int   ++   else   class   eof   string   

原文地址:https://www.cnblogs.com/ars134419622/p/9937366.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!