-
Notifications
You must be signed in to change notification settings - Fork 164
/
Oddeven.c
70 lines (70 loc) · 1.07 KB
/
Oddeven.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
#include<stdio.h>
#include<stdlib.h>
void even()
{
int a,b;
printf("\nEnter number till you want to find the even number. : ");
scanf("%d",&a);
printf("\nEVEN NO. :- \n");
for(b=0;b<=a;b++)
{
if(b%2==0)
{
printf("%d\n",b);
}
}
}
void odd()
{
int c,d;
printf("\nEnter number till you want to find the odd number. : ");
scanf("%d",&c);
printf("\nODD NO. :-\n");
for(d=0;d<=c;d++)
{
if(d%2==1)
{
printf("%d\n",d);
}
}
}
void yes()
{
printf("1. EVEN\n2. ODD\n3. Exit");
}
void no()
{
printf("\nGo ahead as your choice......");
}
int main()
{
int ch,ch1;
printf("1. EVEN\n2. ODD\n3. Exit");
while(1!=0)
{
printf("\nEnter the no. : ");
scanf("%d",&ch);
switch(ch)
{
case 1:even();
break;
case 2:odd();
break;
case 3:exit(1);
default:printf("Wrong Number\n");
}
printf("\nDo you want to print menu again ?");
printf("\nEnter your choice (0/1) :");
scanf("%d",&ch1);
switch(ch1)
{
case 0:yes();
break;
case 1:no();
break;
case 2:exit(0);
break;
default:printf("\nWrong Choice");
}
}
}