0% found this document useful (0 votes)
5 views2 pages

C Program for Day Input Handling

The document contains code for a C program that uses scanf and printf functions to take user input for a day of the week and a character, and uses a switch statement to print the character for the given day or an error message if the day is invalid.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

C Program for Day Input Handling

The document contains code for a C program that uses scanf and printf functions to take user input for a day of the week and a character, and uses a switch statement to print the character for the given day or an error message if the day is invalid.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

#include<stdio.

h>

int main()

char week,a;

printf("m:monday t:tuesday w:wednesday T=thursday f=friday s=saturday S=sunday");

scanf("%c",&week);

printf("enter the day=",a);

scanf("%c",&a);

switch(week)

case 'm':

printf("%c",a);

break;

case 't':

printf("%c",a);

break;

case 'w':

printf("%c",a);

break;

case 'T':

printf("%c",a);

break;

case 'f':

printf("%c",a);

break;

case 's':

printf("%c",a);

break;

case 'S':

printf("%c",a);

break;
default:

printf("week over",a);

printf("programe over");

return 0;

You might also like