
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 33676 Articles for Programming

197 Views
Suppose we have lower limit and upper limit of a range [l, u]. We have to check whether the product of the numbers in that range is positive or negative or zero.So, if the input is like l = -8 u = -2, then the output will be Negative, as the values in that range is [-8, -7, -6, -5, -4, -3, -2], then the product is -40320 so this is negative.To solve this, we will follow these steps −if l and u both are positive, thenreturn "Positive"otherwise when l is negative and u is positive, thenreturn "Zero"otherwise, n := ... Read More

137 Views
Suppose we have a number n, and another number k, we have to check whether the product of digits at even places of n is divisible by k or not. Places are started counting from right to left. Right most is at place 1.So, if the input is like n = 59361, then the output will be True as (1*3*5) is divisible by 3.To solve this, we will follow these steps −digit_count := digit count of given number nprod := 1while n > 0, doif digit_count is even, thenprod := prod * last digit of nn := quotient of (n ... Read More

571 Views
Suppose we have a number n, we have to check whether the product of digits at even places of n is divisible by sum of digits at odd place of n or not. Places are started counting from right to left. Right most is at place 1.So, if the input is like n = 59361, then the output will be True as (1*3*5) = (6+9).To solve this, we will follow these steps −digit_count := digit count of given number ntotal := 0, prod := 1while n > 0, doif digit_count is even, thenprod := prod * last digit of notherwise, ... Read More

585 Views
In this article, we try to find different methods to solve a problem to check whether the product of n numbers is even or odd. A number that is divisible by 2 is known as an even number. otherwise; it is an odd number. For example, 14 and 12 are two even numbers, the product is 168 is an even number. 9 and 5 are two odd numbers, the product is 45 is an odd number. Consider one even number 2 and one odd number 3, product of these two numbers is 6 an even number. Facts to Check if ... Read More

235 Views
Suppose we have a number n. We have to check whether n is dihedral prime or not. A number is said to be dihedral prime when that number is itself prime and also shown same number or any other prime number using 7-segment display regardless the orientation of the display (normal or up-side down).So, if the input is like n = 1181, then the output will be Truesecond one is up-side down format of the first one and both are prime.To solve this, we will follow these steps −Define a function up_side_down() . This will take ntemp := n, total ... Read More

3K+ Views
Suppose we have a number n and another value k. We have to check whether the kth bit in n is set (1) or not. The value of k is considered from right hand side.So, if the input is like n = 23, k = 3, then the output will be True as binary form of 23 is 10111 so the third last bit is 1 (set).To solve this, we will follow these steps −temp := n after shifting bits (k - 1) times to the rightif temp AND 1 is 1, thenreturn Truereturn FalseLet us see the following implementation ... Read More

220 Views
Suppose we have two arrays nums1 and nums2 and another value k. We have to check whether both arrays can be made equal by modifying any one element from the nums1 in the following way (only once): We can add any value from the range [-k, k] to any element of nums1.So, if the input is like nums1 = [5, 7, 11] nums2 = [5, 5, 11] k = 8, then the output will be True as we can add -2 (in range [-8, 8]) with nums1[1] to make it 5 then it will be same as nums2.To solve this, ... Read More

178 Views
Suppose we have three numbers and we have to check whether they are adjacent primes are not. The adjacent primes are prime numbers where no other prime is present between them.So, if the input is like nums = [5, 7, 11], then the output will be True.To solve this, we will follow these steps −if any one of these three numbers is not prime themreturn Falseif next prime of x is not same as y, thenreturn Falseif next prime of y is not same as z, thenreturn Falsereturn TrueLet us see the following implementation to get better understanding −Example CodeLive ... Read More

150 Views
Suppose we have two strings s and t and r, we have to check whether r = s | t or r = t + s where | denotes concatenation.So, if the input is like s = "world" t = "hello" r = "helloworld", then the output will be True as "helloworld" (r) = "hello" (t) | "world" (s).To solve this, we will follow these steps −if size of r is not same as the sum of the lengths of s and t, thenreturn Falseif r starts with s, thenif r ends with t, thenreturn Trueif r starts with t, ... Read More

1K+ Views
Suppose we have a floating point number; we have to check whether the number is odd or even. In general, for integer it is easy by dividing the last digit by 2. But for floating point number it is not straight forward like that. We cannot divide last digit by 2 to check if it is odd or even.So, if the input is like n = 200.290, then the output will be Odd though the last digit is divisible by 2.To solve this, we will follow these steps −s := convert number as stringflag := Falsefor i in range size ... Read More