Answers for "odd even in c"

C
6

c code for even numbrrs

#include <stdio.h>
int main() {
    int num;
    printf("Enter an integer: ");
    scanf("%d", &num);

    // True if num is perfectly divisible by 2
    if(num % 2 == 0)
        printf("%d is even.", num);
    else
        printf("%d is odd.", num);
    
    return 0;
}
Posted by: Guest on May-13-2020
1

odd even in c

#include <stdio.h>
int main() {
    int num;
    printf("Enter an integer: ");
    scanf("%d", &num);

    // true if num is perfectly divisible by 2
    if(num % 2 == 0)
        printf("%d is even.", num);
    else
        printf("%d is odd.", num);
    
    return 0;
}
Posted by: Guest on August-17-2021
0

use & to check even and odd in c

/* Program to check if number is even or odd
 * using bitwise operator
 */
#include<stdio.h>
 
int main()
{
   int n;
 
   printf("Enter an integer: ");
   scanf("%d",&n);
 
   if ( n & 1)
      printf("%d is an odd number", n);
   else
      printf("%d is an even number", n);
 
   return 0;
}
Posted by: Guest on August-17-2021
0

how to know if a number is even in c

if((x & 1) == 0)
    printf("EVEN!\n");
else
    printf("ODD!\n");
Posted by: Guest on July-21-2020
0

even odd numer c

if( num % 2 == 0 )
    printf("EVEN!\n");
else
    printf("ODD!\n");
Posted by: Guest on November-19-2020

Code answers related to "C"

Browse Popular Code Answers by Language