Programming Questions for Practice

Write%20a%20program%20to%20find%20the%20difference%20between%20smallest%20and%20biggest%20prime%20number%20in%20a%20given%20range.%20Assume%20that%20both%20the%20inputs%20are%20positive.


Code not available...
Code not available...
Code not available...

List of programs that you may also intrested


Program Statement Code Available
Hello World program C, Java, Python
Write a function to test whether a given number is even or odd. C, Java, Python
Write a function to test whether a given number is prime or not. C, Java, Python
Write a function to find factorial of a given number. C, Java, Python
Write a function to convert decimal number to binary number. C, Java, Python
Write a function to test whether a given number is a Disarium number. C, Java, Python
Write a function to test whether a given number is happy number. C, Java, Python
Write a function to test whether a given number is Palindrome. C, Java, Python
Write a function to test whether a given number is Armstrong number. C, Java, Python
Write a function to return sum of digits of a given integer number. C, Java, Python
Write a function to print reverse of a given number. C, Java, Python
A company is transmitting data to another server. The data is in the form of numbers. To secure the data during transmission, they plan to obtain a security key that will be sent along with the data. The security key is identified as the count of the unique repeating digits in the data.
Write an algorithm to find the security key for the data.
C
Given an integer, if the number is prime, return 1. Otherwise return its smallest divisor greater than 1. Use the function isPrime(). C
Given an integer n, calculate the first n numbers in the Fibonacci sequence given starting elements of (0,1). Return an array of n integers, including the given (0, 1) in the sequence. Use the function fibonacci(). C
Given an integer num, return the number of steps to reduce it to zero. In one step, if the current number is even, you have to divide it by 2, otherwise, you have to subtract 1 from it. C, Java, Python
Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct. C
Write a method that, given a positive integer number, returns the smallest number with the same number of digits.
For instance, given N=4751, the method returns 1000. Given N=100, the method should return 100. Given N=1, the method should return 0.
C, Java
Write a program to find the simple and compound interest. C
Write a program to swap two numbers without using third variable. C
Write a program to find the greatest of three numbers using conditional operator. C
Write a program to test whether given year is leap year or not. C
Write a function to check the grade of a student based on scores in 5 different subjects. C
Write a function to find the difference between minimum and maximum in given array of elements.
Input: array of elements, length of the array.
Output: difference between min and max.
C
Write a program that test a number is Even or Odd without using remainder operator. C
Write a program to find the difference between smallest and biggest prime number in a given range. Assume that both the inputs are positive. C
Write a function that display a given decimal number in binary number. C, Java, Python
Write a function to set the bit at given position (index) in a binary number. C
Write a function to clear the bit at given position (index) in a binary number. C
Write a function to flip the bit at given position (index) in a binary number. C
A combined Salsa Lesson is to be conducted for two different classes having 8 students each in a school. There are two queues of students, queue A and queue B. You are given a string A denoting the queue sequence of students in queue A and string B denoting the queue sequence of students in queue B. A good pair is a pair containing one boy and one girl. Pairing the students at Nth position of queue A with the student at Nth position of queue B is the only possible method of pairing. Write a program to help the organiser count the total number of good pairs that will be formed, when the students are paired according to the method above. Your task is to return the percentage of good pairs among the total number of pairs that will be formed. C
Write a program to rotate the given array towards left by specified number of places. C
Write a program to rotate the given array towards right by specified number of places. C
Write a program to shift the given array towards right by N number of places. Fill the ZERO in the right most N places. C
Write a program to shift the given array towards left by N number of places. Fill the ZERO in the right most N places. C
Write a program to reverse the given array. C
Write a program to perform addition of two matrices. C
Write a program to perform multiplication of two matrices. C
Write a program to perform transpose of a matrix. C
You are given with an array of integers, arr, of size array_length. Find the index, i, of the first integer num in array arr, that can be represented as a product of two integers A and B. A and B have indices j and k, respectively. If there is no such integer, return -1. C
You are given an array of positive integers, arr, of size array_length. How many elements in array arr are perfectly divisible by either the product or sum of their digits? C
Maximum possible difference of two elements of an array C
Write a program for array rotation by ‘k’ elements to the right. C
Find the minimum element in a sorted and rotated array. C
Find Second largest element in an array C
Find the largest K elements in an array C
Program Statement Code Available