Preview:
#include <stdio.h>
#include <stdlib.h>

//EXERCİSE 2
//Write a modification of first exercise such that while printing the contents of the array the even numbers will be printed first line and odd numbers will be printed on the second line.

//even number are = .....
//odd number are = ......
int arr[10];
    int i;
    for(i=0;i<=9;i++)
    {
        printf("Element %d: ",i+1);
        scanf("%d",&arr[i]);
    }

    printf("Even numbers: ");
    for(i=0;i<=9;i++)
    {
        if(arr[i]%2==0)
            printf("%d ",arr[i]);
    }

    printf("\nOdd numbers: ");
    for(i=0;i<=9;i++)
    {
        if(arr[i]%2==1)
            printf("%d ",arr[i]);
    }
return 0;
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter