-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenubased.c
86 lines (74 loc) · 1.45 KB
/
menubased.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
Name:Sunita Gosai
Date:28dec,2016
Program:WAP a menu based program
Lab Sheet No:13
Subject:Programming Fundamental
*/
#include<stdio.h>
#include<stdlib.h>
int main(){
char c;
int a,b,d,ASCII;
printf("===MENUBASED===\n");
printf("1.EVEN or odd\n");
printf("2.Prime or not\n");
printf("3.Vowel or consonant\n");
printf("4.Alphabet or not\n");
printf("5.Divisible by 11 and 5\n");
printf("6.exit\n");
printf("Enter a character\n");
scanf("%c",&c);
printf("Choose any one");
scanf("%d",&a);
switch(a)
{
case 1:
printf("Enter the first number:\n");
scanf("%d",&d);
if(d%2==0)
{
printf("The no is even\n");
}
else
{printf("The no is odd\n");}
break;
case 2:
printf("Enter the first number:\n");
scanf("%d",&d);
printf("Error");
break;
case 3:
if(c=='a'||c=='A'||c=='e'||c=='E'||c=='i'||c=='I'||c=='o'||c=='O'||c=='u'||c=='U')
{
printf("Vowel");
}
else
printf("Consonent");
break;
case 4:
ASCII=c;
if((ASCII>=65 && ASCII<=90) || (ASCII>=97 && ASCII<=122))
{
printf("The given input is a alphabet");
}
else
printf("The given input is not an alphabet");
break;
case 5:
printf("Enter the first number:\n");
scanf("%d",&a);
if(a%5==0 && a%11==0)
{
printf("the no is divisible by 5 and 11");
}
else
printf("the no isn't divisible by 5 and 11");
break;
case 6:
exit(0);
default:
printf("THANK U FOR VISITING");
}
return;
}