Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- // Counts number of odd elements.a - array, n - size of array
- int cd(int * arr, int n){
- int i, c = 0;
- for(i = 0; i < n; i++){
- if(arr[i] % 2 == 0){
- c++;
- }
- }
- return c;
- }
- int sumeven(int * arr, int n){
- int j, z, s = 0;
- for(j = 0; j < n; j++){
- if(arr[j] % 2 != 0){
- s = s + arr[j];
- }
- }
- return s;
- }
- int count(int * a, int n){
- int z, y = 0;
- for(z = 0; z < n - 1; z++){
- if (a[z] % 5 == 0 || a[z + 1] % 5 == 0){
- y++;
- }
- }
- return y;
- }
- int mul3 (int * a, int n){
- int i, c = 1;
- for(i = 0; i < n; i++){
- if(a[i] % 3 == 0){
- c = c * a[i];
- }
- }
- return c;
- }
- int main(){
- int a[100], n, i;
- scanf("%i", &n);
- for (i = 0; i < n; i++){
- scanf("%i", &a[i]);
- }
- printf("%o\n", mul3(a, n));
- }
Advertisement
Add Comment
Please, Sign In to add comment