Dremendo Tag Line

Input 10 numbers in 1d array and print only two digit even numbers from it in C

One Dimensional Array - Question 1

In this question, we will see how to input 10 numbers in a one dimensional integer array and print only the two digit even numbers from it in C programming. To know more about one dimensional array click on the one dimensional array lesson.

Q1) Write a program in C to input 10 numbers in a one dimensional integer array and print only the two digit even numbers from it.

Program

#include <stdio.h>
#include <conio.h>

int main()
{
    int a[10], i;

    printf("Enter 10 numbers\n");
    for(i=0; i<10; i++)
    {
        scanf("%d",&a[i]);
    }

    printf("List of 2 digit even numbers\n");
    for(i=0; i<10; i++)
    {
    	if(a[i]%2==0 && a[i]>=10 && a[i]<=99)
        {
            printf("%d ",a[i]);
        }
    }
    return 0;
}

Output

Enter 10 numbers
81
23
42
6
94
30
15
63
19
2
List of 2 digit even numbers
42 94 30
video-poster