All even data one side and odd data another side in 1D Array.
#include<stdio.h>
#include<conio.h>
void main( )
{
int arr[10], i ;
clrscr( );
for( i=0; i<10; i=i+1 )
{
printf("Enter data ");
scanf("%d",& arr[i]);
}
for( i=0; i<10; i=i+1 )
{
if( arr[i]%2==0)
{
printf("%d",arr[i]);
}
}
for( i=0; i<10; i=i+1 )
{
if( arr[i]%2!=0 )
{
printf("%d",arr[i]);
}
}
getch( );
}
#include<stdio.h>
#include<conio.h>
void main( )
{
int arr[10], i ;
clrscr( );
for( i=0; i<10; i=i+1 )
{
printf("Enter data ");
scanf("%d",& arr[i]);
}
for( i=0; i<10; i=i+1 )
{
if( arr[i]%2==0)
{
printf("%d",arr[i]);
}
}
for( i=0; i<10; i=i+1 )
{
if( arr[i]%2!=0 )
{
printf("%d",arr[i]);
}
}
getch( );
}
0 Comments