View Code of Problem 89

#include <stdio.h>
int main()
{
	int i;
	char s[20];
	scanf("%s", s);
	for (i = 0; i < strlen(s); i++)
	{
		if (s[i] == 'M')
			printf("Monday\n");
		else if (s[i] == 'T' && s[i + 1] == 'u')
		{
			i++;
			printf("Tuesday\n");
		}
		else if (s[i] == 'T' && s[i + 1] == 'h')
		{
			i++;
			printf("Thursday\n");
		}
		else if (s[i] == 'W')
			printf("Wednesday\n");
		else if (s[i] == 'F')
			printf("Friday\n");
		else if (s[i] == 'S' && s[i + 1] == 'a')
		{
			i++;
			printf("Saturday\n");
		}
		else if (s[i] == 'S' && s[i + 1] == 'u')
		{
			i++;
			printf("Sunday\n");
		}
		else if (s[i] == 'Y')
			break;
		else
			printf("Wrong data\n");
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 89