View Code of Problem 89

#include<stdio.h>
//#include<math.h>
#include<string.h>
int main() {
	char str[200];
	int i;

	gets(str);
	for(i=0; i<strlen(str); i++) {
		if(str[i]=='Y')
			break;

		else	if(str[i]=='M')
			printf("Monday\n");

		else if(str[i]=='T') {
			if(str[i+1]=='h') {
				printf("Thursday\n");
				i++;
			}

			else if(str[i+1]=='u') {
				printf("Tuesday\n");
				i++;
			}

			else
				printf("Wrong data\n");
		}

		else if(str[i]=='W')
			printf("Wednesday\n");

		else 	if(str[i]=='F')
			printf("Friday\n");

		else if(str[i]=='S') {
			if(str[i+1]=='u') {
				printf("Sunday\n");
				i++;
			} else if(str[i+1]=='a') {
				printf("Staurday\n");
				i++;
			}

			else
				printf("Wrong data\n");

		} else
			printf("Wrong data\n");

	}

	return 0;
}

Double click to view unformatted code.


Back to problem 89