Learning!数组|Array

来源:互联网 发布:linux删除文件夹还存在 编辑:程序博客网 时间:2024/06/05 08:34
#include <stdio.h>int main(){const number = 10;int count[number];int i;int x;printf("*******************************\nInput the number from 0 to 9:\n************\n-1 for stop\n************\n");for ( i=0; i<number; i++){        count[i]=0;}do{    scanf("%d", &x);    if ( 0<=x && x<=9)        count[x]++;}while( x != -1);for ( i=0; i<number; i++){    if(count[i]!=0){        printf("\n%d apeared %d time%s\n", i, count[i], count[i] == 1 ? "" : "s");    }}    return 0;}
0 0
原创粉丝点击