Category: C programming

python tutorials and learn python

Created with Sketch.

C program to sort a string in alphabetic order

  C program to sort a string in alphabetic order C program to sort a string in alphabetic order: For example, if a user inputs a string “programming,” then the output will be “aggimmnoprr”, so output string will contain characters in alphabetical order. We assume input string contains only lower case alphabets. We count how…
Read more

C program remove spaces, blanks from a string

  C program remove spaces, blanks from a string C program to remove spaces or excess blanks from a string, For example, consider the string “C programming” There are two spaces in this string, so our program will print the string “C programming.” It will remove spaces when they occur more than one time consecutively…
Read more

C program to change case of a string

  C program to change case of a string Strlwr function converts a string to lower case, and strupr function converts a string to upper case. Here we will change string case with and without strlwr and strupr functions. These functions convert the case of alphabets and ignore other characters that may be present in…
Read more

C program to swap two strings

  C program to swap two strings C program to swap two strings, i.e., their contents are interchanged. C programming code #include <stdio.h> #include <string.h> int main() { char first[100], second[100], t[100]; printf(“Enter first string\n“); gets(first); printf(“Enter second string\n“); gets(second); printf(“\nBefore Swapping\n“); printf(“First string: %s\n“, first); printf(“Second string: %s\n\n“, second); strcpy(t, first); strcpy(first, second); strcpy(second,…
Read more

C program to find the frequency of characters in a string

  C program to find the frequency of characters in a string C program to find the frequency of characters in a string: This program counts the frequency of characters in a string, i.e., which character is present how many times in the string. For example, in the string “code” each of the characters ‘c,’…
Read more

Anagram program in C

  Anagram program in C Anagram program in C to check whether two strings are anagrams or not. The strings are assumed to contain only lower case letters. The strings are anagrams of each other if the letters of one string can be rearranged to form the other string. So, in anagram strings, all characters…
Read more

C read file program

  C read file program C read file program: This C language program reads a file whose name is entered by a user and displays its contents on the screen. Function fopen is used to open a file; it returns a pointer to structure FILE which is a predefined structure in “stdio.h” header file. If…
Read more

C program to copy a file

  C program to copy a file C program to copy a file: This program copies a file, firstly you will specify a file to copy, and then you will enter name and extension of the target file. We will open the file that we wish to copy in “read” mode and target file in…
Read more

C program to merge two files

  C program to merge two files C program to merge two files and store their contents in another file. The files to be merged are opened in “read” mode and the file that contains contents of both the files is opened in “write” mode. For merging, we open a file and read it character…
Read more

C program to list files of a directory

  C program to list files of a directory C program to list all files present in a directory/folder in which executable file of this program is present. For example, if the executable file is present in C:\\TC\\BIN then it will list all the files present in C:\\TC\\BIN. C programming code (Turbo C compiler only)…
Read more