View Code of Problem 89

#include<stdio.h>
#include<string.h>
int main()
{
	int i;
	char s[50];
	gets(s);
	for(i=0;i!='Y';i++)
	{
		switch(s[i])
		{
		case 'M':printf("Monday\n");break;
		case 'W':printf("Wednseday\n");break;
		case 'F':printf("Friday\n");break;
		case 'T':
				if(s[i+1]=='u')
					{printf("Tuesday\n");i++;}
				else if(s[i+1]=='h')
					{printf("Thursday\n");i++;}
				else 
					printf("Wrong data\n");
				break;
		case 'S':
				if(s[i+1]=='u')
					{printf("Sunday\n");i++;}
				else if(s[i+1]=='a')
					{printf("Saturday\n");i++;}
				else 
					printf("Wrong data\n");
				break;
		default:printf("Wrong data\n");
		}
	}
		return 0;
}

Double click to view unformatted code.


Back to problem 89