View Code of Problem 89

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

Double click to view unformatted code.


Back to problem 89