Hits: 7 (C programming Example for Beginners) C Program to Display its own Source Code as Output In this example, you’ll learn to display source of the program using __FILE__ macro. Though this problem seems complex, the concept behind this program is straightforward; display the content from the same file you are writing the source …
Hits: 10 (C programming Example for Beginners) C Program to Write a Sentence to a File In this example, you will learn to write a sentence in a file using fprintf() statement. This program stores a sentence entered by the user in a file. #include <stdio.h> #include <stdlib.h> int main(){ char sentence[1000]; // creating file …
Hits: 0 (C programming Example for Beginners) C Program to Store Information of Students Using Structure In this example, you will learn to store the information of 5 students by using an array of structures. Store Information in Structure and Display it #include <stdio.h> struct student { char firstName[50]; int roll; float marks; } s[10]; …
Hits: 7 (C programming Example for Beginners) C Program to Add Two Complex Numbers by Passing Structure to a Function In this example, you will learn to take two complex numbers as structures and add them by creating a user-defined function. Add Two Complex Numbers #include <stdio.h> typedef struct complex { float real; float imag; …
Hits: 2 (C programming Example for Beginners) C Program to Store Information of a Student Using Structure In this example, you will learn to store the information of a student in a structure and display them on the screen. Store Information and Display it Using Structure #include <stdio.h> struct student { char name[50]; int roll; …
Hits: 4 (C programming Example for Beginners) C Program to Concatenate Two Strings In this example, you will learn to concatenate two strings manually without using the strcat() function. As you know, the best way to concatenate two strings in C programming is by using the strcat() function. However, in this example, we will concatenate two strings …
Hits: 4 (C programming Example for Beginners) C Program to Find the Length of a String In this example, you will learn to find the length of a string manually without using the strlen() function. As you know, the best way to find the length of a string is by using the strlen() function. However, in this …
Hits: 7 (C programming Example for Beginners) C Program to Remove all Characters in a String Except Alphabets In this example, you will learn to remove all the characters from a string entered by the user except the alphabets. Remove Characters in String Except Alphabets #include <stdio.h> int main(){ char line[150]; printf(“Enter a string: “); …
Hits: 8 (C programming Example for Beginners) C Program to Find the Frequency of Characters in a String In this example, you will learn to find the frequency of a character in a string. Find the Frequency of a Character #include <stdio.h> int main(){ char str[1000], ch; int count = 0; printf(“Enter a string: “); …
Hits: 7 (C programming Example for Beginners) C Program to Find Largest Number Using Dynamic Memory Allocation In this example, you will learn to find the largest number entered by the user in a dynamically allocated memory. Find the Largest Element in a Dynamically Allocated Memory #include <stdio.h> #include <stdlib.h> int main(){ int num; float …
Hits: 5 (C programming Example for Beginners) C Program to Multiply two Matrices by Passing Matrix to a Function In this example, you’ll learn to multiply two matrices and display it using user defined function. This program asks the user to enter the size of the matrix (rows and column). Then, it asks the user …
Hits: 3 (C programming Example for Beginners) C Program to Find Transpose of a Matrix In this example, you will learn to find the transpose of a matrix in C programming. The transpose of a matrix is a new matrix that is obtained by exchanging the rows and columns. In this program, the user is …
Hits: 4 (C programming Example for Beginners) C Program to Multiply Two Matrices Using Multi-dimensional Arrays In this example, you will learn to multiply two matrices and display it using user-defined functions. This program asks the user to enter the size (rows and columns) of two matrices. To multiply two matrices, the number of columns of …
Hits: 1 (C programming Example for Beginners) C Program to Add Two Matrices Using Multi-dimensional Arrays In this example, you will learn to add two matrices in C programming using two-dimensional arrays. Program to Add Two Matrices #include <stdio.h> int main(){ int r, c, a[100][100], b[100][100], sum[100][100], i, j; printf(“Enter the number of rows (between …
Hits: 9 (C programming Example for Beginners) C Program to Calculate Standard Deviation In this example, you will learn to calculate the standard deviation of 10 numbers using arrays. This program calculates the standard deviation of an individual series using arrays. Visit this page to learn about Standard Deviation. To calculate the standard deviation, we have …
Hits: 5 (C programming Example for Beginners) C Program to Find Largest Element in an Array In this example, you will learn to display the largest element entered by the user in an array. Find the Largest Element in an array #include <stdio.h> int main(){ int i, n; float arr[100]; printf(“Enter the number of elements …