Basic C Program Examples

C Program Examples
C program to read a file
C program to read a file

The working mechanism of this source code is similar to above source code. But, it uses the function fopen() to open the file.txt file in reading mode i.e. function is called with “file.txt” and “r” as argument. After the file is opened in reading mode, the content of file.txt is displayed on the screen and file is closed.

C Program Examples
C Program to Find Transpose of a Matrix
C Program to Find Transpose of a Matrix

This Program computes the transpose of the matrix and prints it on the screen as simply interchange the rows and columns of the matrix.

C Program Examples
C Program to Check Whether a Number is Positive or Negative
C Program to Check Whether a Number is Positive or Negative

The internal execution of the program depends upon the entered Integer.After the successful compilation of the program, a message is displayed on the screen as Enter a number: if user entered 6 then compiler checks that 6 is greater than 0 therefore it is a positive number not negative or 0 therefore, again a message displayed on the screen as You entered a positive number.

C Program Examples
C Program to Concatenate Two Strings
C Program to Concatenate Two Strings

The internal working of this program depends upon the length of the strings.After the successful compilation of the program, a message is displayed on the screen as Enter first string: User Enter Welcome Then, again a message displayed Enter second string: If second time user entered User then the final output is Concatenated string is WelcomeUser.

C Program Examples
C Program to find the frequency of characters in a String
C Program to find the frequency of characters in a String

As we know that time is the most important concern in our life. To do any task easily, We have to use software to perform it in a simpler manner. Software is a set of programs with related documents. The Software Program or Program is a set of instructions to do a specific task.

C Program Examples
C Program to Count Number of Digits in an Integer
C Program to Count Number of Digits in an Integer

The internal execution of the program depends upon the entered Integer.After the successful compilation of the program, a message is displayed on the screen as Enter a number in whose digits you want to count.If you entered 436 then again a message displayed as The number of digits in above integer is : 3

C Program Examples
C Program to Find ASCII Value of a Character
C Program to Find ASCII Value of a Character

This program evaluates The ASCII value of inserted character. In this program, the user is asked to enter 'A' character. The character is stored in variable a. When %d format string is used, 65 (the ASCII value of G) is displayed. When %c format string is used, 'A' itself is displayed.

C Program Examples
C Program to Compute Quotient and Remainder
C Program to Compute Quotient and Remainder

This program evaluates and Compute Quotient and Remainder when an integer is divided by another integer. In this program, the user is asked to enter two integers (dividend and divisor) which are stored in variable dividend and divisor respectively. Finally, the quotient and remainder are displayed as output.

C Program Examples
C Program to Check Whether a Character is an Alphabet or not
C Program to Check Whether a Character is an Alphabet or not

In this Program, the if…else statement is used to check whether a character entered by the user is alphabet or not? The alphabets A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, and Z are called Alphabet. All other characters except these 26 letters are not an Alphabet. If User entered any character rather than 26 Alphabet than a print like # is not an alphabet.

C Program Examples
C Program to Check Whether a Character is Vowel or Consonant
C Program to Check Whether a Character is Vowel or Consonant

In this Program, the if…else statement is used to check whether an alphabet entered by the user is a vowel or a constant. The five letters A, E, I, O and U are called vowels. All other letters except these 5 vowel letters are called consonants. This program assumes that the user will always enter an alphabetic character.

Write For Us.

Contribute the Community.