Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to check if number is even

if ( n % 2 == 0 ) {
	// n is even
}
else {
	//otherwise odd
}
Comment

check if a number is even or odd

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

Even or odd number

/* Program to check whether the input integer number 
 * is even or odd using the modulus operator (%)
 */
#include<stdio.h>
int main()
{
   // This variable is to store the input number 
   int num;
 
   printf("Enter an integer: ");
   scanf("%d",&num);
 
   // Modulus (%) returns remainder
   if ( num%2 == 0 )
      printf("%d is an even number", num);
   else
      printf("%d is an odd number", num);
 
   return 0;
}
Comment

check whether number is even or odd

#check wheather a is odd or even
'''interactive mode
>>> 10%2
0....................False #(False==0)
>>> 5%2
1....................True  #(True==1)'''
#scriptive mode
a=int(input('enter:'))
if a%2:
    print("its odd")#solution gives true if 'a' value is even
else:
    print("its even")#solution gives false if 'a' value is odd 
print('hope it helped')
#output
#False
enter:100
its even
hope it helped
#even
enter:101
its odd
hope it helped
Comment

Finding Even and Odd Numbers

<?php
      $check1 = 3534656;
      $check2 = 3254577;
      if($check1%2 == 0) {
        echo "$check1 is Even number <br/>";
        
      } else {
        echo "$check1 is Odd number <br/>";
      }

      if($check2%2 == 0) {
        echo "$check2 is Even number";
      } else {
        echo "$check2 is Odd number";
      }
    ?>
Comment

check a number is odd or even

def is_even(num):
	return not bool(num % 2)
Comment

PREVIOUS NEXT
Code Example
Javascript :: join string js with and at the last item 
Javascript :: combine all ts files into one js 
Javascript :: js access sql database on server 
Javascript :: tradingview custom data feed 
Javascript :: Regex Match Only Number Lines 
Javascript :: array for numbers 
Javascript :: public static void main(dsjjsdds, jdnjd, jsndjsd, isjdjsd, sjdijs, skjdks_+) __ osakd___ +++ 
Javascript :: (function (g, d, a) {})(window, document, jQuery); 
Javascript :: what i sminify javascript 
Javascript :: jquery-3.5.1.min.js download 
Python :: import keys selenium 
Python :: check if tensorflow gpu is installed 
Python :: python suppress warning 
Python :: pygame boilerplate 
Python :: how to install OpenCV? 
Python :: vowel and consonant list python 
Python :: conda install lxml 
Python :: where to import messages in django 
Python :: how to make pyautogui faster 
Python :: how to get micro symbol in python 
Python :: httpie on windows 
Python :: ctrl c exception python 
Python :: python urlencode 
Python :: update anaconda from cmd 
Python :: python upload video to youtube 
Python :: python get output of command to variable 
Python :: python dlete folder 
Python :: find element by title selenium python 
Python :: import user in django 
Python :: python regex for a url 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =