Category Archives: C Programs

C Programs

C Program to Implement Linear Search

In this tutorial, we will learn to create a C program that will do Implement Linear Search using C programming.

Prerequisites

Before proceeding with this tutorial we assume that you are best aware of the following C programming topics:

  • Operators in C Programming.
  • Basic Input and Output function in C Programming.
  • Basic C programming.
  • Conditional statement in C Programming.
  • Creating and Using the user-defined function in C programming.

In every programming language, the sorting of data is a very important factor. Sorting works are done mainly with the techniques available in C Language. Many different techniques for sorting are available to work.

But the data structure work is incomplete without the searching of the data. In today’s tutorial, we will Implement the Linear Search in the array to find the element in the array.

Algorithm:-

 


 

Output:-

In the above program, we have first declared and initialized a set of variables required in the program.

  • search = it will hold the size of an array.
  • array[100]= it will hold the elements in an array.

Input from the user for.

Taking input number for.

Printing the output.

C Program to Implement Binary Search

In this tutorial, we will learn to create a C program that will do Implement Binary Search using C programming.

Prerequisites

Before proceeding with this tutorial we assume that you are best aware of the following C programming topics:

  • Operators in C Programming.
  • Basic Input and Output function in C Programming.
  • Basic C programming.
  • Conditional statement in C Programming.
  • Creating and Using the user-defined function in C programming.

In every programming language, the sorting of data is a very important factor. Sorting works are done mainly with the techniques available in C Language. Many different techniques for sorting are available to work.

But the data structure work is incomplete without the searching of the data. In today’s tutorial, we will implement the binary search in the array to find the element in the array.

Algorithm:-

 


 

Output:-

In the above program, we have first declared and initialized a set of variables required in the program.

  • n = it will hold the size of an array.
  • ary[]= it will hold the elements in an array.

After this, we make the user-defined function for searching.

Printing the output.

C Program to Check Reverse equal Original

C Program to Reverse equal Original

In this tutorial, we will learn to create a C program that will Reverse equal Original in C programming.

Prerequisites

Before starting with this tutorial we assume that you are best aware of the following C programming topics:

  • Operators in C Programming.
  • Basic Input and Output function in C Programming.
  • Basic C programming.
  • While loop in C programming.

Program to Reverse equal Original:-

As we all know the c is a very powerful language. With the help of c programming language, we can make many programs. We can perform many input-output operations using c programming. In today’s tutorial, we take the input numbers from the user. Then we will Generate Armstrong Numbers between the taken range with the help of the c programming language.

With the help of this program, we can Reverse equal Original.

Algorithm:-

 

Program to Reverse equal Original:-

 

Output:-

In the above program, we have first initialized the required variable.

  • no = it will hold the integer value.
  • orig = it will hold the integer value.
  • rev = it will hold the integer value.
  • rem = it will hold the integer value.

Taking the input integer number from the user.

Calculating the reverse equal.
Printing the output numbers.

 

C Program to Generate Armstrong Numbers

C Program to Generate Armstrong Numbers

In this tutorial, we will learn to create a C program that will Generate Armstrong Numbers in C programming.

Prerequisites

Before starting with this tutorial we assume that you are best aware of the following C programming topics:

  • Operators in C Programming.
  • Basic Input and Output function in C Programming.
  • Basic C programming.
  • While loop in C programming.

Program to Generate Armstrong Numbers:-

As we all know the c is a very powerful language. With the help of c programming language, we can make many programs. We can perform many input-output operations using c programming. In today’s tutorial, we take the input numbers from the user. Then we will Generate Armstrong Numbers between the taken range with the help of the c programming language.

With the help of this program, we can Generate Armstrong Numbers.

Algorithm:-

 

Program to Generate Armstrong Numbers:-

 

Output:-

In the above program, we have first initialized the required variable.

  • no1 = it will hold the integer value.
  • no2 = it will hold the integer value.
  • flag = it will hold the integer value.
  • noOfDigit = it will hold the integer value.
  • num = it will hold the integer value.
  • res = it will hold the integer value.
  • pow = it will hold the integer value.
  • i = it will hold the integer value.

Taking the input integer number interval from the user.

Swapping the numbers.
Printing the output numbers.

 

C Program to Interchange Numbers

C Program to Interchange Numbers

In this tutorial, we will learn to create a C program that will Interchange Numbers in C programming.

Prerequisites

Before starting with this tutorial we assume that you are best aware of the following C programming topics:

  • Operators in C Programming.
  • Basic Input and Output function in C Programming.
  • Basic C programming.
  • While loop in C programming.

Program to Interchange Numbers:-

As we all know the c is a very powerful language. With the help of c programming language, we can make many programs. We can perform many input-output operations using c programming. In today’s tutorial, we take the input numbers from the user. Then we will Interchange Numbers with the help of the c programming language.

With the help of this program, we can Interchange Numbers.

Algorithm:-

 

Program to Interchange Numbers using a third variable:-

 

Output:-

In the above program, we have first initialized the required variable.

  • first= it will hold the double value.
  • second = it will hold the double value.
  • flag = it will hold the double value.

Taking the input number 1.

Taking the input number 2.

Swapping the numbers.
Printing the output numbers.

C Program to find Area & Perimeter of Square

C Program to find Area & Perimeter of Square

In this tutorial, we will learn to create a C program that will find the Area & Perimeter of Square in C programming.

Prerequisites

Before starting with this tutorial we assume that you are best aware of the following C programming topics:

  • Operators in C Programming.
  • Basic Input and Output function in C Programming.
  • Basic C programming.
  • While loop in C programming.

Program to find Area & Perimeter of Square:-

As we all know the c is a very powerful language. With the help of c programming language, we can make many programs. We can perform many input-output operations using c programming. In today’s tutorial, we take the input in the form size of a side of the square. Then we will find its area and parameter with the help of the c programming language.

With the help of this program, we can find the Area & Perimeter of the Square.

Algorithm:-

 

Program to find the Area & Perimeter of Square:-

 

Output:-

In the above program, we have first initialized the required variable.

  • side = it will hold the float value.
  • area = it will hold the float value.
  • paremeter = it will hold the float value.

Taking the input from the message.

Calculating the Area of Square.
Calculating the Perimeter of Square.

C Program to Delete Vowels from String

C Program to Delete Vowels from String

In this tutorial, we will learn to create a C program that will Delete Vowels from String in C programming.

Prerequisites

Before starting with this tutorial we assume that you are best aware of the following C programming topics:

  • Operators in C Programming.
  • Basic Input and Output function in C Programming.
  • Basic C programming.
  • While loop in c programming.
  • Conditional statements in C programming.
  • String functions of c programming.

Program to Delete Vowels from String

As we all know the String is a collection of character data types. In strings, only one variable is declared which can store multiple values. First, we will take the input string from the user. Then we will Delete Vowels from String using the while loop.

With the help of this program, we can Delete Vowels from String.

Algorithm:-

 

Program to Delete Vowels from String:-

 

Output:-

In the above program, we have first initialized the required variable.

  • s[100] = it will hold the string value.
  • t[100] = it will hold the string value.
  • i = it will hold the integer value.
  • d = it will hold the integer value.

Taking the input string from the user.

Removing the vowels from the string.
Printing the output.

C Program to Delete Word from String

C Program to Delete Word from String

In this tutorial, we will learn to create a C program that will Delete Word from String in C programming.

Prerequisites

Before starting with this tutorial we assume that you are best aware of the following C programming topics:

  • Operators in C Programming.
  • Basic Input and Output function in C Programming.
  • Basic C programming.
  • While loop in c programming.
  • Conditional statements in C programming.
  • String functions of c programming.

Program to Delete Word from String

As we all know the String is a collection of character data types. In strings, only one variable is declared which can store multiple values. First, we will take the input string from the user. Then we will Delete the Word from String using the while loop.

With the help of this program, we can Delete Word from String.

Algorithm:-

 

Program to Delete Word from String:-

 

Output:-

In the above program, we have first initialized the required variable.

  • str[100] = it will hold the string value.
  • word[20] = it will hold the string value.
  • i = it will hold the integer value.
  • j = it will hold the integer value.
  • chk = it will hold the integer value.
  • temp = it will hold the integer value.
  • ls = it will hold the integer value.
  • lw = it will hold the integer value.

Taking the input string from the user.

Using string function to get the length of string and the word.
Removing the word from the string.
Printing the output.

C Program to Remove Spaces from String

C Program to Remove Spaces from String

In this tutorial, we will learn to create a C program that will Remove Spaces from String in C programming.

Prerequisites

Before starting with this tutorial we assume that you are best aware of the following C programming topics:

  • Operators in C Programming.
  • Basic Input and Output function in C Programming.
  • Basic C programming.
  • While loop in c programming.
  • Conditional statements in C programming.
  • String functions of c programming.

Program to Remove Spaces from String

As we all know the String is a collection of character data types. In strings, only one variable is declared which can store multiple values. First, we will take the input string from the user. Then we will remove the spaces from the string using the while loop.

With the help of this program, we can Remove Spaces from String.

Algorithm:-

 

Program to Remove Spaces from String:-

 

Output:-

In the above program, we have first initialized the required variable.

  • str[50] = it will hold the string value.
  • i = it will hold the integer value.
  • j = it will hold the integer value.
  • chk = it will hold the integer value.

Taking the input string from the user.

Removing the blank spaces from the string.
Printing the output.

C Program to Check Anagram or Not

C Program to Check Anagram or Not

In this tutorial, we will learn to create a C program that will Check Anagram or Not in C programming.

Prerequisites

Before starting with this tutorial we assume that you are best aware of the following C programming topics:

  • Operators in C Programming.
  • Basic Input and Output function in C Programming.
  • Basic C programming.
  • For loop in c programming.
  • Conditional statements in C programming.
  • String functions of c programming.

Program to Check Anagram or Not

As we all know the String is a collection of character data types. In strings, only one variable is declared which can store multiple values. First, we will take the input string from the user.

Then we will sort that string using the for a loop.

With the help of this program, we can Check Anagram or Not.

Algorithm:-

 

Program to Check Anagram or Not:-

 

Output:-

In the above program, we have first initialized the required variable.

  • str1[] = it will hold the string value.
  • str2[] = it will hold the string value.
  • temp = it will hold the string value.
  • i = it will hold the integer value.
  • j = it will hold the integer value.
  • n1 = it will hold the integer value.
  • n2= it will hold the integer value.

Using string functions to get the length of both the strings.

If both the strings are different then not anagrams.

Sorting both the strings.

Comparing both the strings after Sorting.

Printing the output.

C Program to Multiply Two Matrices

C Program to Print Multiply Two Matrices

In this tutorial, we will learn to create a C program that will Print Multiply Two Matrices  C programming.

Prerequisites

Before starting with the tutorial we assume that you are best aware of the following C programming topics:

  • Operators in C Programming.
  • Basic Input and Output function in C Programming.
  • Basic C programming.
  • For loop in C programming.

Program to Print Multiply Two Matrices

In c programming, it is possible to take a numerical input for the size of the matrix and the elements of the matrix from the user and Print Multiply Two Matrices with the help of a very small amount of code. The C language has many types of header libraries which has supported function in them with the help of these files the programming is easy.

Algorithm:-

With the help of this program, we can Print Multiply Two Matrices.

Program:-

 

Output:-

 

In the above program, we have first initialized the required variable.

  • a[10][10]= it will hold the integer value.
  • b[10][10]= it will hold the integer value.
  • mul[10][10]= it will hold the integer value.
  • r= it will hold the integer value.
  • c= it will hold the integer value.
  • k= it will hold the integer value.
  • i= it will hold the integer value.
  • j= it will hold the integer value.

Taking the size of the matrix from the user.

Input elements of both the matrices.

Calculating the multiply of the two matrices.

Printing the output for the program.

C Program to Sum All Matrix Elements

C Program to Print Sum All Matrix Elements

In this tutorial, we will learn to create a C program that will Print Sum All Matrix Elements using C programming.

Prerequisites

Before starting with the tutorial we assume that you are best aware of the following C programming topics:

  • Operators in C Programming.
  • Basic Input and Output function in C Programming.
  • Basic C programming.
  • For loop in C programming.

Program to Print Sum of All Matrix Elements

In c programming, it is possible to take a numerical input for the size of the matrix and the elements of the matrix from the user and Print Sum of All Matrix Elements with the help of a very small amount of code. The C language has many types of header libraries which has supported function in them with the help of these files the programming is easy.

Algorithm:-

With the help of this program, we can Print Sum of All Matrix Elements.

Program:-

 

Output:-

 

In the above program, we have first initialized the required variable.

  • a[10][10]= it will hold the integer value.
  • r= it will hold the integer value.
  • c= it will hold the integer value.
  • sum= it will hold the integer value.
  • i= it will hold the integer value.
  • j= it will hold the integer value.

Taking the elements of the matrix from the user.

Calculating the sun of all the elements of the matrix.

Printing the sum for all the elements of the matrix.