List/Grid C Subscribe RSS feed of category C
How to Perform Linear Search using C Language
Consider you have an array of 10 numbers and you want to find out position of a particular number. Linear Search can help you with that and it is one of the best criteria to search when you have un-ordered list of number. Linear Search is a method for finding a particular in an array or list, which consists of checking every element of that array, one at a time…
How to check whether a number is Armstrong Number in C
Armstrong Numbers are those numbers which are equal to the sum of its own digits each raised to the power of the number of digits in the number. Consider number 153, it has three digits, so length is 3. Now each digits raised to the power of the number of digits in the number : 13 = 1, 53 = 125, 33 = 27. Sum of these values : 1…
How to find Nth Perfect Number in C language
Perfect Numbers are those numbers which is equal to the sum of its proper positive divisors (excluding itself). Consider number 6, it has only four proper positive divisors 1, 2, 3 and 6. If we exclude 6, proper divisors left are 1, 2 and 3 and their sum is 6 which is equal to the number itself. So, 6 is a Perfect Number. You can learn more about Perfect Numbers…
How to find Nth Prime Number in C language
Prime numbers are the numbers greater than 1 which are divisible only by 1 and itself, like 3 is divisible by 1 and 3 only. So, if a natural number n is a Prime Number, then it is divisible by only 1 and n and not divisible by any number from the sequence 2, 3, 4, . . . . , (n – 1). You can find more information about…
How to find Prime Factors of a number in C language
In Number Theory, every Natural Number can be expressed as a multiple of Prime Numbers only and those Prime Numbers are called Prime Factors of that number. So, Prime Factors of a positive integer are the Prime Numbers which can divide the number perfectly that is no remainder will be left. More information about Prime Factors can be found on Wikipedia. In this example, I will show you a C…
How to find LCM using GCD- Euclid’s Method
Least Common Multiple (LCM) of two numbers is the smallest positive integer which is also a multiple of both the numbers. If any of the two numbers is 0, LCM of those two numbers will be 0. You can find more about LCM of two numbers on Wikipedia. In this tutorial, I will show you how can you find LCM of two numbers using Euclid’s Method i.e. by using GCD…
How to check whether a number is Perfect in C
Perfect Numbers are those numbers which are equal to the sum of its proper positive divisors (excluding itself). Consider number 6, it has only four proper positive divisors 1, 2, 3 and 6. If we exclude 6, proper divisors left are 1, 2 and 3 and their sum is 6 which is equal to the number itself. So, 6 is a Perfect Number. You can also say that Perfect Number…
How to find Greatest Common Divisor ( GCD ) using Euclid’s Method in C
Greatest Common Divisor ( GCD ) or Highest Common Factor ( HCF ) or Greatest Common Factor ( GCF ) of two numbers is the greatest positive integer that perfectly divides both the numbers. You can find more about GCD of two numbers on Wikipedia. In this tutorial, I will show you a very simple way to find GCD of two numbers using Euclid’s Method in C language. You can…
How to find Greatest Common Divisor ( GCD ) of two numbers in C
Greatest Common Divisor ( GCD ) or Highest Common Factor ( HCF ) or Greatest Common Factor ( GCF ) of two numbers is the greatest positive integer that perfectly divides both the numbers. You can find more about GCD of two numbers on Wikipedia. In this tutorial, I will show you a very simple way to find GCD of two numbers using C language. You can also find GCD…