#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main() { char a[1000]; scanf("%s",&a); int i; for(i=0;i<strlen(a);i++){ if(a[i]=='Y'){ break; } if(a[i]=='M'){ printf("Monday\n"); } else if(a[i]=='T'){ if(a[i+1]=='u'){ printf("Tuesday\n"); i++; } else if(a[i+1]=='h'){ printf("Thursday\n"); i++; } 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]=='u'){ printf("Sunday\n"); i++; } else if(a[i+1]=='a'){ printf("Saturday\n"); i++; }else{ printf("Wrong data\n"); } } else{ printf("Wrong data\n"); } } } |
Double click to view unformatted code.