Category Archives: C Programs

C Programs

C Program to find Area & Circumference of Circle

C Program to find Area & Circumference of Circle

In this tutorial, we will learn to create a C program that will find the Area & Circumference of Circle 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 Circle:-

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 radius of the Circle. Then we will find its area and Circumference with the help of the c programming language.

With the help of this program, we can find the Area & Circumference of the Circle.

Algorithm:-

 

Program to find the Area & Perimeter of Circle:-

 

Output:-

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

  • radius = it will hold the float value.
  • area = it will hold the float value.
  • perimeter = it will hold the float value.

Taking the input from the message.

Calculating the Area of Circle.
Calculating the Perimeter of Circle.

 

C Program to find Area & Perimeter of Rectangle

C Program to find Area & Perimeter of Rectangle

In this tutorial, we will learn to create a C program that will find the Area & Perimeter of Rectangle 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 Rectangle:-

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 length and width of the Rectangle. 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 Rectangle.

Algorithm:-

 

Program to find the Area & Perimeter of Rectangle:-

 

Output:-

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

  • lgth = it will hold the float value.
  • wdth = it will hold the float value.
  • area = it will hold the float value.
  • perimeter = it will hold the float value.

Taking the input from the message.

Calculating the Area of Rectangle.
Calculating the Perimeter of Rectangle.

 

C Program to Print Sum of Each Row and Column of given Matrix

C Program to Print Sum of Each Row and Column of given Matrix

In this tutorial, we will learn to create a C program that will Print Sum of Each Row and the Column of the given Matrix 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 Each Row and the Column of the given Matrix

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 Each Row and the Column of the given Matrix 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 Each Row and the Column of the given Matrix.

Program:-

Output:-

 

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

  • m= it will hold the integer value.
  • n= it will hold the integer value.
  • arr[m][n]= it will hold the integer value.

Taking the elements of the matrix from the user.

Printing the input matrix.

Printing the sum for rows and columns.

C Program to find Largest Element in Matrix

C Program to Find Largest Element in Matrix

In this tutorial, we will learn to create a C program that will find the Largest Element in Matrix 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.
  • Conditional statement in C programming.

Program to find Largest Element in Matrix

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 find the Largest Element in Matrix 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 find the Largest Element in Matrix.

Program:-

 

Output:-

 

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

  • mat[3][3]= 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 largest element matrix.

Printing the largest element of the matrix.

C Program to Print Diamond Pattern

C Program to Print Diamond Pattern

In this tutorial, we will learn to create a C program that will create a diamond pattern using 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.

Create a diamond:-

The C language is a very powerful programming language. In C programming we can perform many operations with the help of codings. The c language is very easy to create any pattern. With the help of the c programming, we will create a diamond pattern.First we will take the number of rows in input and then we will print the pattern.

In this program, we will learn to create diamond-like patterns with the help of c programming.

Algorithm:-

 

Program:-

To create a diamond pattern

 

Output:-

 

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

  • i = it will hold the integer value to control the parent for loop.
  • j = it will hold the integer value to control the child for a loop.
  • k = it will hold the integer value to control child for loop.
  • r = it will hold the integer value for the number of rows of pattern.

Initializing the first parent for loop size and number of rows.

For Loop to print the blank spaces.

For Loop to print the “ * ”.

Main Program Code.

C Program to Convert Decimal to Binary

C Program to Convert Decimal to Binary

In this tutorial, we will learn to create a C program that will Convert Decimal to Binary 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 Convert Decimal to Binary:-

As we all know the c is a very powerful language. With the help of c programming language, we can make many programs. We cal perform many input-output operations using c programming. In today’s tutorial, we take the input in Decimal from the user and convert it into  Binary. With the help of c programming, we can perform many conversion operations.

With the help of this program, we can Convert Decimal to Binary.

Algorithm:-

 

Program to Convert Decimal to Binary:-

 

Output:-

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

  • bin= it will hold the integer value.
  • n = it will hold the integer value.

Taking the input from the message.

Declaring the function.
Body of the conversion function.
Calling for converting function.
Printing output number.

 

C Program to Convert Decimal to Hexadecimal

C Program to Convert Decimal to Hexadecimal

In this tutorial, we will learn to create a C program that will Convert Decimal to Hexadecimal 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 Convert Decimal to Hexadecimal:-

As we all know the c is a very powerful language. With the help of c programming language, we can make many programs. We cal perform many input-output operations using c programming. In today’s tutorial, we take the input in Decimal from the user and convert it into HexaDecimal. With the help of c programming, we can perform many conversion operations.

With the help of this program, we can Convert Decimal to Hexadecimal.

Algorithm:-

 

Program to Convert Decimal to Hexadecimal:-

 

Output:-

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

  • deci = it will hold the integer value.
  • i = it will hold the integer value.

Taking the input from the message.

Loop for converting the number.
Printing output number.

C Program to Convert Binary to Hexadecimal

C Program to Convert Binary to Hexadecimal

In this tutorial, we will learn to create a C program that will Convert Binary to Hexadecimal 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 Convert Binary to Hexadecimal:-

As we all know the c is a very powerful language. With the help of c programming language, we can make many programs. We cal perform many input-output operations using c programming. In today’s tutorial, we take the input in Binary from the user and convert it into HexaDecimal. With the help of c programming, we can perform many conversion operations.

With the help of this program, we can Convert Binary to Hexadecimal.

Algorithm:-

 

Program to Convert Binary to Hexadecimal:-

 

Output:-

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

  • binary_number = in will hold the integer value.

Taking the input from the message.

Scanning the input number from the user.
Loop for converting the number.
Printing output number.

 

C Program to Convert Octal to Decimal

C Program to Convert Octal to Decimal

In this tutorial, we will learn to create a C program that will Convert Octal to Decimal 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 Convert Octal to Decimal:-

As we all know the c is a very powerful language. With the help of c programming language, we can make many programs. We cal perform many input-output operations using c programming. In today’s tutorial, we take the input in octal from the user and convert it into Decimal. With the help of c programming, we can perform many conversion operations.

With the help of this program, we can Convert octal to Decimal.

Algorithm:-

 

Program to Convert Octal to Decimal:-

 

Output:-

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

  • octalNumber = in will hold the integer value for the input.

Taking the input.

Function for Binary to decimal.
Printing the Decimal data.
Main Function.

C Program to Convert Decimal to Octal

C Program to Convert Decimal to Octal

In this tutorial, we will learn to create a C program that will Convert Decimal to Octal 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 Convert Octal to Decimal:-

As we all know the c is a very powerful language. With the help of c programming language, we can make many programs. We cal perform many input-output operations using c programming. In today’s tutorial, we take the input in Decimal from the user and convert it into Octal. With the help of c programming, we can perform many conversion operations.

With the help of this program, we can Convert Decimal to Octal.

Algorithm:-

 

Program to Convert Decimal to Octal:-

 

Output:-

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

  • decimalNumber = in will hold the integer value for the input.

Taking the input.

Function for Decimal to Octal.
Printing the Decimal to Octal.
Main Function.

 

C Program to Convert Binary to Decimal

C Program to Convert Binary to Decimal

In this tutorial, we will learn to create a C program that will Convert Binary to Decimal 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.

Program to Convert Binary to Decimal:-

As we all know the c is a very powerful language. With the help of c programming language, we can make many programs. We cal perform many input-output operations using c programming. In today’s tutorial, we take the input in Binary from the user and convert it into Decimal. With the help of c programming, we can perform many conversion operations.

With the help of this program, we can Convert Binary to Decimal.

Algorithm:-

 

Program to Convert Binary to Decimal:-

 

Output:-

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

  • n = in will hold the long integer value for the input.

Taking the input.

Function for Binary to decimal.
Printing the Decimal data.
Main Function.

 

C Program to Convert Binary to Octal

C Program to Convert Binary to Octal

In this tutorial, we will learn to create a C program that will Convert Binary to Octal 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.

Program to Convert Binary to Octal:-

As we all know the c is a very powerful language. With the help of c programming language, we can make many programs. We cal perform many input-output operations using c programming. In today’s tutorial, we take the input in binary from the user and convert it into octal. With the help of c programming, we can perform many conversion operations.

With the help of this program, we can Convert Binary to Octal.

Algorithm:-

 

Program to Convert Binary to Octal:-

Output:-

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

  • bin = in will hold the integer value.

Taking the input.

Function for Binary to decimal then decimal to octal.
Printing the binary data.
Main Function.