Category Archives: C Programs

C Programs

C Program to replace all Vowels in String with given character

C Program to replace all Vowels in String with a given character

In this tutorial, we will learn to create a C program that will replace all Vowels in String with a given character 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.
  • String functions of c programming.
  • Conditional Statements in the C programming

Replace all Vowels in String with a given character

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 will take the replacing character from the user and swap it with the vowels in the string.

With the help of this program, we can replace all Vowels in String with a given character.

Algorithm:-

 

Program to replace all Vowels in String with a given character:-

 

Output:-

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

  • str[50] = it will hold the string value.
  • ch = it will hold the string value.
  • i = it will hold the string value.

Input strings from the user.

Replacing the vowel with the character.

Printing the output.

C Program to Print Array Elements at Odd Position

C Program to Print Array Elements at Odd Position

In this tutorial, we will learn to create a C program that will Print Array Elements at Odd Positions 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.
  • Arithmetic Operators in C programming.

As we all know array is a collection of similar data type elements. In an array, only one variable is declared which can store multiple values. First will take the number of elements of an array from the user. Then will take the elements from the user for the array. And at last, we will Print Array Elements at Odd Positions C Programming Language.

With the help of this program, we can Print Array Elements at Odd Positions.

Algorithm:-

 

Program to Print Array Elements at Odd Positions:-

 

Output:-

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

  • arry[10][32] = it will hold the string value.
  • i = it will hold the integer value for controlling the loop.

Insert the elements in the array for printing the odd index values.

Printing the array elements of the odd index values in the output.

C Program to Print Good Morning Evening Night according to Time

C Program to Print Good Morning Evening Night according to Time

In this tutorial, we will learn to create a C program that will Print Good Morning Evening Night according to Time 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.
  • Conditional Statements in c programming.

A program that will Print Good Morning, Evening, Night according to Time

As we all know the C programming is a very powerful programming language.With the help of which we can take input in all datatypes. In today’s program, we will create a c program that will take the input in the form of an integer, and then it will calculate the time and Print Good Morning, Evening, Night according to Time. 

Algorithm:-

With the help of this program, we can Print Good Morning, Evening, Night according to Time.

 

Program to Print Good Morning Evening Night according to Time:-

 

Output:-

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

  • t = it will hold the integer value for time input.

Input strings from the user.

Calculating the time taken from input and printing the Greeting message.

 

C Program to Print Content of File in Reverse Order

C Program to Print Content of File in Reverse Order

In this tutorial, you will learn about the C Program to Print Content of File in Reverse Order with a practical example.

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.
  • Concepts of while loop.
  • Conditional Statements in C programming.
  • Using file functions of c language.

As we all know the file is a collection of characters, integers, and many data types. In strings, only one variable is declared which can store multiple values. First will take the string from the user. Then will pass that string to a for loop reading the file. The C programming language has many pre-defined functions for string manipulation. but in today’s tutorial, we will Print the Content of the File in Reverse Order.

With the help of this program, we can Print Content of File in Reverse Order

Algorithm:-

Program:-

 

Output:-

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

  • *fp = it will hold the address value.
  • ch = it will hold the character value.
  • fname[30] = it will hold the string value of the file name.
  • newch[500] = it will hold the string value of the file.
  • i = it will hold the integer value.
  • j = it will hold the integer value.
  • COUNT = it will hold the integer value.

Taking Input string from the user.

Reading the file.

Printing the original data from the file.

Printing output data.

C Program to Sort Names in Alphabetical Order

C Program to Sort Names in Alphabetical Order

In this tutorial, we will learn to create a C program that will Sort Names in Alphabetical Order 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.
  • String functions in C programming.
  • Conditional statement in C Programming.

Sort Names in Alphabetical Order:-

As we all know String is a collection of similar data type elements. In an array, only one variable is declared which can store multiple values. First will take the string input from the user. Then will pass that string to the for loop to sort it in alphabetical order. And at last, we will Sort Names in Alphabetical Order C Programming Language.

Algorithm:-

Program:-

Sort Names in Alphabetical Order

Output:-

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

  • s[100] = it will hold the elements in a string.
  • str[100][100] = it will hold the string value.
  • i = it will hold the integer value to control the array.
  • j = it will hold the integer value to control the array.
  • n = it will hold the integer value to control the array.

Taking input string from the user.

Sorting the string in alphabetical order.

Printing the results.

 

C Program to Check Alphabet or Not

C Program to Check Alphabet or Not

In this tutorial, we will learn to create a C program that will Check Alphabet or Not using the 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.
  • Conditional Statements in C programming.
  • String concepts in C Programming.

Program to Check Vowel or Not

In c programming, it is possible to take character input from the user and Check Alphabet or Not 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. The string manipulation is very easy in C programming. In today’s program, we will take a character in input and Check Alphabet or Not.

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

Algorithm:-

Program to Check Alphabet or Not:-

 

Output:-

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

  • c= it will hold the character value.

Input character from the user.

Program Logic Code.

Printing output Check Alphabet or Not.

C Program to Check Vowel or Not

C Program to Check Vowel or Not

In this tutorial, we will learn to create a C program that will Check Vowel or Not 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.
  • Conditional Statements in C programming.
  • String concepts in C Programming.

Program to Check Vowel or Not

In c programming, it is possible to take character input from the user and Check Vowel or Not 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. The string manipulation is very easy in C programming. In today’s program, we will take a character in input and Check Vowel or Not.

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

Algorithm:-

Program to Check Vowel or Not:-

 

Output:-

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

  • c= it will hold the character value.
  • lowerchar= it will hold the integer value.
  • upperchar= it will hold the integer value.

Input character from the user.

 

Program Logic Code.

Printing output Check Vowel or Not.

C Program to Count Even Odd

C Program to Count Even Odd

In this tutorial, we will learn to create a C program that will Count Even Odd in Array 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.
  • Conditional Statements in C programming.
  • Arithmetic operations in C Programming.

Program to Count Even Odd in Array

In c programming, it is possible to take numerical input from the user and Count Even Odd 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.

The Count Even-Odd, Even numbers are those numbers that are completely divisible by 2. which means the reminder should be zero. And odd numbers are those numbers that cannot be completely divisible by 2.

With the help of this program, we can Count Even Odd in Array.

Algorithm:-

Program to Count Even Odd in Array:-

 

Output:-

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

  • arr[10]= it will hold the integer value.
  • i = it will hold the integer value.
  • Size= it will hold the integer value.
  • EvenNo = it will hold the integer value.
  • OddNo= it will hold the integer value.

Input size and elements of the array.

 

Program Logic Code.

Printing output Count Even Odd in Array.

C Program to Print Even Numbers in an Array

C Program to Print Even Numbers in Array

In this tutorial, we will learn to create a C program that will Print Even Numbers in Array 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.
  • Conditional Statements in C programming.
  • Arithmetic operations in C Programming.

Program to Print Even Numbers in Array

In c programming, it is possible to take numerical input from the user and Print Even Numbers in Array 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.

The Even numbers are those numbers that are completely divisible by 2. which means the reminder should be zero.

With the help of this program, we can Print Even Numbers in Array.

Algorithm:-

Program to Print Even Numbers in Array:-

 

Output:-

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

  • arry[5]= it will hold the integer value of the input.
  • i = it will hold the integer value.

Input message for the user for five integer values.

Input for loop for taking array elements.

Program Logic Code.

Printing output Even digits

C Program to Print Odd Numbers in Array

C Program to Print Odd Numbers in Array

In this tutorial, we will learn to create a C program that will Print Odd Numbers in Array 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.
  • While loop in C programming.
  • Conditional Statements in C programming.
  • Arithmetic operations in C Programming.

Program to Print Odd Numbers in Array

In c programming, it is possible to take numerical input from the user and Print Odd Numbers in Array 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.

The odd numbers are those numbers that are not completely divisible by 2. which means the reminder should not be zero.

With the help of this program, we can Print Odd Numbers in Array.

Algorithm:-

Program to Print Odd Numbers in Array:-

 

Output:-

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

  • arry[5]= it will hold the integer value of the input.
  • i = it will hold the integer value.

Input message for the user for five integer values.

Input for loop for taking array elements.

Program Logic Code.

Printing output odd digits

C Program to Find LCM of n Numbers

C Program to Find LCM of n Numbers

In this tutorial, we will learn to create a C program that will Find LCMof n numbers 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.
  • While loop in C programming.
  • Arithmetic operations in C Programming.

Program to Find LCM of n numbers

In c programming, it is possible to take numerical input from the user and find LCM of n numbers 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.

With the help of this program, we can Find LCM of n numbers

Here,

LCM:- Least Common Multiple.

Algorithm:-

 

Program to Find LCM of n numbers:-

 

 

Output:-

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

  • i = it will hold the integer value.
  • mp = it will hold the integer value.
  • arr[10] = it will hold the integer value.
  • n = it will hold the integer value.
  • count = it will hold the temporary integer value.

Input number from the user.

 

Calculating the LCM of the given numbers.

 

Printing the LCM of the given numbers.

C Program to Find HCF of n Numbers

C Program to Find HCF of n Numbers

In this tutorial, we will learn to create a C program that will Find HCF of n numbers 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.
  • Arithmetic operations in C Programming.

Program to Find HCF of n numbers

In c programming, it is possible to take numerical input from the user and find HCF of n numbers 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.

With the help of this program, we can Find HCF of n numbers

Here,

HCF:- Highest Common Factor.

Algorithm:-

 

Program to Find HCF of n numbers:-

 

 

Output:-

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

  • i = it will hold the integer value.
  • j = it will hold the integer value.
  • h = it will hold the integer value.
  • n = it will hold the integer value.
  • a[100] = it will hold the integer value.

Input number from the user.

 

User-defined function HCF.

 

Input-output code in the main method body.