forked from AjinkyaSahu/DSA
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswitch.c
More file actions
45 lines (38 loc) · 903 Bytes
/
Copy pathswitch.c
File metadata and controls
45 lines (38 loc) · 903 Bytes
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
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i;
printf("1. All numbers from 1 to 10\n");
printf("2. EVEN numbers from 1 to 10\n");
printf("3. ODD numbers from 1 to 10\n");
printf("Enter your choice : ");
int n;
scanf("%d", &n);
switch (n)
{
case 1:
for(i = 1; i <= n; i++)
{
printf("%d ", i);
}
break;
case 2:
for(i = 2; i <= 10; i+=2)
{
printf("%d ", i);
}
break;
case 3:
for(i = 1; i <= 10; i+=2)
{
printf("%d ", i);
}
break;
default:
printf("Incorrect Choice\n");
break;
}
printf("\n");
return 0;
}