View Code of Problem 89

#include<stdio.h>
int main()
{
	char str[100];
	int i=0,j;
	while(scanf("%c",&str[i])!=EOF&&str[i]!='Y')
        i++;
    for(j=0;j<i;j++)
    {
        if(str[j]=='M')
            printf("Monday\n");

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

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

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

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

        else if(str[j]=='S'&&str[j+1]=='a')
        {
            j++;
            printf("Saturday\n");
        }

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

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

	return 0;
}

Double click to view unformatted code.


Back to problem 89