C Program to Compute LCM of Multiple Integers

In mathematics, Least Common Multiple or Lowest Common Multiple (LCM) of two integers is the lowest possible positive integer that is divisible by both the integers. We’ll first see how to write C program to compute LCM of two integers. Then we’ll extend that logic for multiple integers. APPROACH 1: LCM Using GCD We can … Continue reading “C Program to Compute LCM of Multiple Integers”

C Program to Find GCD Using Recursion

In mathematics, Greatest Common Divisor (GCD), also known as Highest Common Factor (HCF), of two or more integers is the largest possible integer that divides all the numbers without any reminder. To find out GCD at least one of the integers has to be no-zero. Here we’ll see how to white a recursive function to find … Continue reading “C Program to Find GCD Using Recursion”

Implement Binary Search in C

Binary search is an efficient searching technique that is used to search a key in a sorted array. In every iteration, searching scope is reduced to half. That’s why it is called Binary Search or Half Interval search. Binary Search Algorithm If the middle element of the sub-array is equal to the key, then the … Continue reading “Implement Binary Search in C”

Where to Use Different Types of Loops (for, while, do-while) in C

Loops are very fundamental programming language constructs that allow us to execute a block of code multiple times. In C programming language, there are three types of loops: for, while and do-while. Here we will discuss on the syntax of every loop and where to use them. Though we have three types of loops, any one … Continue reading “Where to Use Different Types of Loops (for, while, do-while) in C”

How to Implement Periodic Timer in Linux Kernel

Linux Kernel already has a timer module that allows us to create timers which are not periodic by default. We can specify a callback function and a timeout value to the module. After expiry of the timeout value, the callback function will be called. Problem is the callback function will be called only once. Here we’ll … Continue reading “How to Implement Periodic Timer in Linux Kernel”

1
0
0
2
1
0