Program Console Vignaankosh.com
Execution Panel
Console is empty.
Count even and odd elements in array using function is an interactive C dry run visualizer from the Functions programs section. Study the source code, then use the execution controls to follow each step, variable update, highlighted line, and console output.
This page provides a browser-based dry run with source-code highlighting, auto-scroll, voice narration controls, and execution output for learning the program step by step.
#include <stdio.h>
int countEven(int arr[], int size) {
int count = 0;
for(int i = 0; i < size; i++) {
if(arr[i] % 2 == 0) {
count++;
}
}
return count;
}
int countOdd(int arr[], int size) {
int count = 0;
for(int i = 0; i < size; i++) {
if(arr[i] % 2 != 0) {
count++;
}
}
return count;
}
int main() {
int nums[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int n = sizeof(nums) / sizeof(nums[0]);
int evenCount = countEven(nums, n);
int oddCount = countOdd(nums, n);
printf("Even numbers: %d\n", evenCount);
printf("Odd numbers: %d\n", oddCount);
return 0;
}