Search
 
SCRIPT & CODE EXAMPLE
 

C

countoddevenDifference

#include <stdio.h>
int countOddEvenDifference(int n, int arr[])
{
    int odd = 0, even = 0;
    for(int i=0; i<n; i++)
    {
        if(arr[i]%2==0)
        {
            even = even+1;
        }
        else
        {
            odd = odd+1;
        }   
    }
    return odd - even;
}
int main()
{
    int n;
    scanf("%d",&n);
    int array[n];
    for(int i=0; i<n; i++)
    {
        scanf("%d",&array[i]);
    }
    int result = countOddEvenDifference(n, array);
    printf("%d",result);
    return 0;
}
Comment

PREVIOUS NEXT
Code Example
C :: come fare un programma in c con cui interagire 
C :: scanf autotrash c 
C :: C++ initalize int16_t value 
C :: Write a c program to add two numbers without using addition operator. 
C :: c ternary operator 
C :: C what does /= mean 
C :: c if statement 
C :: C printf Declaration 
C :: recursion c prime number 
C :: c check if is a right triangle 
Dart :: flutter delay 
Dart :: TextStyle underline flutter 
Dart :: change color of drawer icon flutter 
Dart :: const text style flutter 
Dart :: reverse srring in dart 
Dart :: showdialog with builder flutter 
Dart :: dart yaxlitlash 
Dart :: dart absolute value 
Dart :: flutter chip delete 
Dart :: dart collection for 
Dart :: dart string interpolation 
Dart :: flutter print line char limit 
Dart :: RenderFlex overflowed 
Dart :: flutter container height 100 percent 
Dart :: compute flutter 
Dart :: dart init Map 
Dart :: flutter images 
Dart :: how to add cards in flutter 
Dart :: dart pow 
Dart :: enum flutter 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =