View Code of Problem 8

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main() {
	int n,i,count;
	char a[1000];
	scanf("%d",&n);
	while(n--){
		scanf("%s",&a);
	int l=strlen(a);
	int k=a[l-1]-'0';
	switch(k){
		case 0:count=287;break;
		case 1:count=294;break;
		case 2:count=286;break;
		case 3:count=293;break;
		case 4:count=293;break;
		case 5:count=293;break;
		case 6:count=293;break;
		case 7:count=293;break;
		case 8:count=294;break;
		case 9:count=294;break;
	}
		printf("%d\n",count);
	}
}

Double click to view unformatted code.


Back to problem 8