C Programs

55 Lessons

C Program to Insert an Element in an Array

This C program code will insert an element into an array, and it does not mean increasing size of the array. For example consider an array n[10] having four elements: n[0] = 1, n[1] = 2, n[2] = 3 and n[3] […]

    C Program to Merge Two Arrays

    C program to merge two arrays into one array, Arrays are assumed to be sorted in ascending order. Enter the two short sorted arrays and combine them to obtain a large array. Program: #include <stdio.h> void merge(int [], int, int […]

      C Program to Find Maximum Element in Array

      This program find maximum or largest element present in an array. It also prints the location or index at which maximum element occurs in array. Program: #include <stdio.h> int main() { int array[100], maximum, size, c, location = 1; printf("Enter […]

        C Program to Find Minimum Element in Array

        C program to find smallest element present in an array. It also prints the location or index at which minimum element occurs in array. Program: #include <stdio.h> int main() { int array[100], minimum, size, c, location = 1; printf("Enter the […]

          C Program to Reverse an Array

          This program reverses the array elements. For example if a is an array of integers with three elements such that a[0] = 1 a[1] = 2 a[2] = 3 Then on reversing the array will be a[0] = 3 a[1] […]

            C Program to Print Integer

            This C program is used to print given integer input by the user on the screen. scanf function is used to obtain input and printf function is used to print the number on the screen. Example: #include<stdio.h> int main() { […]

              C Program to Insertion Sort Using Array

              This C program will show you how to short numbers at the time of Insertion. This code implements insertion sort algorithm to arrange numbers of an array in ascending order. With a little modification it will arrange numbers in descending […]

                C Program to Delete an Element from an Array

                Deleting an element does not affect the size of array. It is also checked whether deletion is possible or not. For example if array is containing five elements and you want to delete element at position six which is not […]

                  C Program to Merge Two Files

                  This C program merges two files and stores their contents in another file. The files which are to be merged are opened in read mode and the file which contains content of both the files is opened in write mode. […]

                    C Program to Swapping Two Numbers Using a Temporary Variable

                    This C program is used to swapping two numbers, using a temporary variable. Example: #include<stdio.h> int main() { int x, y, temp; printf("Enter the value of x and y: "); scanf("%d %d", &x, &y); printf("Before swapping x=%d, y=%d ", x, […]

                      C Program to Reverse Number

                      This C program reverse the number entered by the user, and then prints the reversed number on the screen. For example if user enter 423 as input then 324 is printed as output. We use modulus(%) operator in program to […]

                        Scroll Back to Top