This is a C Program which finds the even and odd numbers in an array.
Here all the elements in the array are checked for even and odd condition , when the condition satisfies it prints out the result
PROGRAM :
OUTPUT :
Related Programs:
Here all the elements in the array are checked for even and odd condition , when the condition satisfies it prints out the result
PROGRAM :
#include <stdio.h> #include <stdlib.h> int main() { int i,n; printf("How many elements ?\t"); scanf("%d",&n); int a[n]; for(i=0;i<n;i++) { printf("Enter number %d \t",i+1); scanf("%d",&a[i]); } printf("\nThe Even Numbers are : \t"); for(i=0;i<n;i++) { if(a[i]%2 == 0) printf("%d \t",a[i]); } printf("\nThe Odd Numbers are : \t"); for(i=0;i<n;i++) { if(a[i]%2 != 0) printf("%d \t",a[i]); } return 0; }
OUTPUT :
C - Even and Odd Elements in an Array |
Even and Odd numbers in an Array( Java )
Sum Of Elements in an Array( C )
Largest Element in an Array( C )
Smallest Element in an Array( C )
Ascending Order( C )
Descending Order( C )
Largest Element in an Array( C )
Smallest Element in an Array( C )
Ascending Order( C )
Descending Order( C )
Sum Of Elements in an Array( Java )
Largest Elements in an Array( Java )
Smallest Element in an Array( Java )
Ascending Order( Java )
Descending Order( Java )
Smallest Element in an Array( Java )
Ascending Order( Java )
Descending Order( Java )
No comments:
Post a Comment