Write a C program using two dimensional arrays that determine the even numbers among the twelve input values from the keyboard and prints the list of these even numbers
#include <stdio.h>
const int n = 12;
int arr[n];
int main() {
int tarr[n];
for (int i = 0, j = 0; i < n; i++) {
cin >> arr[i];
if (arr[i] % 2 == 0) {
tarr[j++] = arr[i];
}
}
for (int i = 0; i < j; i++) {
cout << tarr[i] << " ";
}
return 0;
}
Comments
Leave a comment