View Code of Problem 8

#include<stdio.h>
#include<string.h>
int main()
{
	int m , i , len ;
	char a[20];
    scanf("%d", &m);
    for (i=0;i<m;i++)
	{
		scanf("%s",&a);
		len=strlen(a);
		if(a[len-1]=='0')
		printf("287\n");
		else if (a[len-1]=='2')
		printf("286\n");
		else if(a[len-1]=='1'||a[len-1]=='8'||a[len-1]=='9')
		printf("294\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");
	}
	 
}

Double click to view unformatted code.


Back to problem 8