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

Practical 6

Uploaded by

nilgadhiya20
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views4 pages

Practical 6

Uploaded by

nilgadhiya20
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

NIL GADHIYA Practical 6 23SE02IE068

Aim 1 : Take a value from user and print day name using Switch-case.

Input :

#include <stdio.h>

int main() {

int day_number;

printf("Enter a number (1-7) representing the day: ");

scanf("%d", &day_number);

switch(day_number) {

case 1:

printf("Monday\n");

break;

case 2:

printf("Tuesday\n");

break;

case 3:

printf("Wednesday\n");

break;

case 4:

printf("Thursday\n");

break;

case 5:

printf("Friday\n");

break;
NIL GADHIYA Practical 6 23SE02IE068

case 6:

printf("Saturday\n");

break;

case 7:

printf("Sunday\n");

break;

default:

printf("Invalid day number\n");

return 0;

Output :
NIL GADHIYA Practical 6 23SE02IE068

Aim 2 : Write a program to check input character is either Vowel or


Consonant using Switch-case.

Input :
#include <stdio.h>

int main() {

char ch;

printf("Enter a character: ");

scanf(" %c", &ch);

if (ch >= 'a' && ch <= 'z') {

ch = ch - 'a' + 'A';

switch(ch) {

case 'A':

case 'E':

case 'I':

case 'O':

case 'U':

printf("%c is a Vowel.\n", ch);

break;

default:

printf("%c is a Consonant.\n", ch);

return 0;

Output :
NIL GADHIYA Practical 6 23SE02IE068

You might also like