Search
 
SCRIPT & CODE EXAMPLE
 

C

odd and even number c

// @Author: Subodh 
// 1 liner solution
(num & 1) ? cout << num << " is odd" : cout << num << " is even" << endl;
Comment

Odd-Even-inator with function in C

#include<stdio.h>

int isEven(int);

int main(void) {
  int n, x, a;
  
  int array[n];
  
  printf("Enter n: ");
  scanf("%d", &n);
  
  int elem[n];
  
  for(x=0; x<n; x++){
    
  printf("Enter value #%d: ", x+1);
  scanf("%d", &elem[x]);
    
   a = elem[x];
    
    if(isEven(a))
    printf("%d is even
",a);
    
    else
      printf("%d is odd
",a);
}
    return 0;
}

int isEven(int n) {
    return n % 2 == 0;
}
Comment

PREVIOUS NEXT
Code Example
C :: deepak rake 
C :: How to scale all columns in dataframe in R- Method 2? 
C :: send array to child process c 
C :: ::template 
C :: [4,5,6] 
C :: yt-project annotate_scale 
C :: profile time bash script 
C :: write varriable in file C 
C :: Trasmettere variabile float attraverso seriale 
C :: convert integer to float in c 
C :: snake spielen 
C :: c logarithm check if number is base 
C :: Sampoo C programming 
C :: split string at space C 
C :: c Write a program to reverse an array or string 
C :: C Create struct Variables 
Dart :: flutter keyboard causes overflow 
Dart :: asset image in circle avatar flutter 
Dart :: flutter check if string is number 
Dart :: flutter textfield rounded 
Dart :: loop in dart 
Dart :: dart timer 
Dart :: slice string dart 
Dart :: Round button with text and icon in flutter 
Dart :: how to disable screen rotation in flutter 
Dart :: dart jsonencode list 
Dart :: flutter check if platform is ios or andriod 
Dart :: how to subtract dates in flutter 
Dart :: flutter alertdialog 
Dart :: flutter blur background 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =