# Basic C Program Examples

##### C program to check leap year This Program accepts year from users and check whether the given year is leap year or not using ladder if else.

##### C program to find factorial of a number The factorial of a positive number n is calculated by: The factorial of n (n!) = 1 * 2 * 3 * 4....n In this program we will find the factorial of a number where the number should be entered by the user. Factorial is sequence of a number whose multiply all previous number.

##### C program to find lcm of two numbers This Program stores two integers one by one into the int datatype. After that find the least common factor of these two numbers as shown as output.

##### C program to find gcd of two numbers This Program stores two integers one by one into the int datatype. After that find the Greatest common factor of these two numbers as shown as output.

##### C program to swap two numbers without using third variable This Program stores two integers one by one into the int datatype. After the successful swapping of numbers it will exchange the value of them at once or you can say that it assign a's value to b and b's value to a.

##### C program to swap two numbers This Program stores two integers one by one into the int datatype. After the successful swapping of numbers it will exchange the value of them at once.

##### C program to print prime numbers between 1-100 This Program runs a loop from 2 to 100 and checks for each current number within range that it is prime or not. After the successful execution of the program it displays the list of all prime numbers from 2 to 100. As we know that 1 is not a prime number so we don't need to check it.

##### C program to find prime number This Program stores an integer into the variable with int datatype. After it is used for the loop it checks all divisors between 2 and the number itself. Then, Compare it is divisible or not by any number rather than 1 and itself. At last If the user input 1 then it shows the 1 is a prime number. Next, If the user inter 23 then it displays 23 is a prime number and Display to enter another number.

##### C program to add two numbers This Program stores two integers into the int datatype by using to variables. After that store the sum of these two variables into another variable and display it on the screen.After the successful compilation of the program, Program sums up the two entered numbers at once.

##### C program to reverse any number by using function This Program reversed any number such as Integer, float, or decimal in their equivalent. After the successful compilation of the program, a message is displayed on the screen as Please! Enter a string that you want to reverse: Suppose, User, entered 11001 then again a message is displayed as The Equivalent Reversed Number is 10011. Read more...