輸入一個(gè)正整數(shù)N,然后求出輸出這個(gè)N位數(shù)中有幾個(gè)數(shù)含有偶數(shù)個(gè)“3”
1 回答

快樂的時(shí)光
TA貢獻(xiàn)79條經(jīng)驗(yàn) 獲得超48個(gè)贊
#include <stdio.h>
#include <malloc.h>
void main()
{
char *a;
char *p;
int count = 0;
a = (char*)malloc(sizeof(char)*20);
scanf("%s",a);
for(p=a;*p!='\0';p++)
if(*p=='3') count++;
printf("count = %d\n",count);
}
- 1 回答
- 0 關(guān)注
- 1177 瀏覽
添加回答
舉報(bào)
0/150
提交
取消