#define N 3????????????????????//輸入要比較的省份證號碼的個數#define year 2017????????//輸入當前年份#include<stdio.h>#include<math.h>void main(){?????? char a[19];?????? int i,j,t=0,k,s;?????? int b[5];?????? printf("請輸入身份證號碼:\n");?????? for(i=0;i<N;i++)????????????? gets(a);????????//循環(huán)輸入省份證號碼?????? for(i=0;i<N;i++)?????? {????????????? for(j=9;j>5;j--)????????????? {?????????????????????? b[j-6]=a[j];???????????????????? t=b[j-6];???????????????????? s+=(pow(10,9-j)*t);????????????? }???????????????????? if(s==year-18)???????????????????? k=k+1;?????? }????????????? printf("18歲的人數是:%d\n",k);}
- 1 回答
- 0 關注
- 20045 瀏覽
添加回答
舉報
0/150
提交
取消