Search
 
SCRIPT & CODE EXAMPLE
 

C

odd even in c with ternary operator

#include <stdio.h>
int main() {
    int num;
    printf("Enter an integer: ");
    scanf("%d", &num);
    // true if num is perfectly divisible by 2
   num % 2 == 0 ? printf("%d is even.", num); :  printf("%d is odd.", num);
    return 0;
}
Comment

PREVIOUS NEXT
Code Example
C :: c pass int by reference 
C :: comment c 
C :: strcmp c 
C :: print short in c 
C :: c memset 
C :: space x 
C :: what is syntax in programming 
C :: addition.c 
C :: how to print in c 
C :: C Arithmetic Operators 
C :: Grepper VSCode Add On 
C :: loading builder in flutter 
C :: bootstrap 4 forms 
C :: c loop 
C :: typedef c struct 
C :: printf("%3d ",XX); 
C :: multiplication of matrix in c 
C :: rfid rc522 code 
C :: how to sort an int array in c 
C :: powershell list big files 
C :: bcopy 
C :: string in c and how it works 
C :: c unused variable 
C :: english to russian translation 
C :: ubuntu ocaml install 
C :: how to declare an array of n numbers in c 
C :: C static libraries (Indexing an archive) 
C :: Fibonacci program c pthread 
C :: tytykjtuky 
C :: perl file handling 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =