View Code of Problem 8

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


int main()
{
	int n,len;
	char s[30];
	scanf("%d",&n);
	while (n>0) 
	{
		gets(s);
		if(*s!='\0')
		{
			len = strlen(s);
			if (s[len - 1] == '0' )printf("287\n");
			else if (s[len - 1] == '1' || s[len - 1] == '8'||s[len-1]=='9')printf("294\n");
			else if (s[len - 1] == '2')printf("286\n");
			else printf("293\n");
			n--;
		}		
	}


	return 0;	
}

Double click to view unformatted code.


Back to problem 8