7-1

 

#include<stdio.h>
int main(void)
{
    int count[9];
    int i,response;
    for(i=1;i<=8;i++);
    count[i]=0;
    for(i=1;i<=10;i++){
        printf("input your response:");
        scanf("%d",&response);
        if(response<1||response>8)
            printf("this is a bad response:%d\n",response);
        else
            count[response]++;
    }
        printf("result:\n");
        for(i=1;i<=8;i++)
            printf("%4d%4d\n",i,count[i]);
        return 0;
}

posted @ 2013-10-08 00:19  傻子疯子捏子  阅读(153)  评论(0编辑  收藏  举报