WELCOME TO MY BLOG BY SHABEEB.K

C,C++ PROGRAMMING: CATOGORIZE ODD NUMBERS AND EVEN NUMBERS SPERATLY.

Search This Blog

Wednesday, 4 September 2013

CATOGORIZE ODD NUMBERS AND EVEN NUMBERS SPERATLY.

 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
#include<stdio.h>
#include<conio.h>
int i,n;
struct numbers
{
int n1,odd,even;

}num[90];


       void main()

       {

 void read();
 void display1();
 void display2();

 clrscr();

 printf("ENTER LIMIT\n");
 scanf("%d",&n);

 read();
 display1();
 display2();


 getch();
}

void read()
{
printf("\n ENTER %d NUMBERS\n",n);
for(i=1;i<=n;i++)
{
 scanf("%d",&num[i].n1);
}
}
void display1()
{
printf("\nODD NUMBERS\n");
for(i=1;i<=n;i++)
{
if(num[i].n1%2==1)
printf("\t %d ,",num[i].n1);
}
}

void display2()
{
printf("\n EVEN NUMBERS\n");
for(i=1;i<=n;i++)
{
if(num[i].n1%2==0)
printf("\t %d ,",num[i].n1);
}
}
 





No comments:

Post a Comment