View Code of Problem 89

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

Double click to view unformatted code.


Back to problem 89