View Code of Problem 8

#include<stdio.h>
#include<string.h>
int main(){
	int n;
	scanf("%d",&n);
	char a[100];
	while(n--){
		scanf("%s",a);
		int len=strlen(a);
		if(a[len-1]=='0')
		printf("287\n");
		else if(a[len-1]=='1'||a[len-1]=='8')
		printf("294\n");
		else if(a[len-1]=='2')
		printf("286\n");
		else if(a[len-1]=='3'||a[len-1]=='4'||a[len-1]=='5'||a[len-1]=='6'||a[len-1]=='7')
		printf("293\n");
		else
		printf("296\n");
	}
} 

Double click to view unformatted code.


Back to problem 8