#include <stdio.h>
int numOfX(int ,int);
int numX(int ,int);
void printS();
int main(){
int num;
scanf("%d",&num);
printf("%d\n",numOfX(num,7));
printS();
}
int numOfX(int n ,int x){
int numCopy = n;
int digit = 0;
int numOf = 0;
while( numCopy >= 1){
digit = numCopy % 10;
if(digit == x){
numOf ++;
}
numCopy /= 10;
}
return numOf;
}
void printS(){
int i ,j ,k;
for( i = 1;i <= 5; i++){
for(j = 1;j <= 3; j++){
for(k = 1;k <= 4; k++){
printf("*");
}
printf("\n");
}
printf("\n");
}
}
[C How To Program] 习题3.38
最新推荐文章于 2019-03-10 17:46:29 发布