Category Archives: Basic C Programs C Source Code

Display Yearly Calendar C Program

Topic: Display Yearly Calendar C Program First of all this c program will require a four digit year to input. As soon as the use enters a correct year for example, 2020, this c program will display calendar of the year 2020 month wise. This c program to display calendar uses smaller modules called functions… Read More »

 2,852 total views,  23 views today

C Program Display and Count Odd Numbers in Array

C Program Display and Count Odd Numbers in Array /* C Program to display and count all odd numbers in array www.EasyCodeBook.com */ #include <stdio.h> int main() { int array[100],i,n, count=0; printf(“Enter number of elements in array = “); scanf(“%d”, &n); printf(“Enter %d numbers in array\n”, n); for (i = 0; i < n; i++)… Read More »

 623 total views,  1 views today

C Program Find Sum of Even Numbers in Array

C Program Find Sum of Even Numbers in Array /* C Program to Find Sum of Even numbers in array www.EasyCodeBook.com */ #include <stdio.h> int main() { int array[100],i,n, sum=0; printf(“Enter number of elements in array = “); scanf(“%d”, &n); printf(“Enter %d numbers in array\n”, n); for (i = 0; i < n; i++) {… Read More »

 586 total views

C Program Count Frequency of Each Element in Array

C Program Count Frequency of Each Element in Array This C Program will Find Number of Occurences of Every Element in Array. /* C Program to Count frequencies of each element of an array of numbers www.EasyCodeBook.com */ #include <stdio.h> int main() { int array[100], array2[100], n, i, j, element, count;; printf(“Enter number of elements… Read More »

 889 total views,  3 views today

C Program Sum of Main Diagonal of Square Matrix

C Program Sum of Main Diagonal of Square Matrix   /* Write a C program to input a Square matrix of m rows and m columns and displaying the sum of the main diagonal elements from top left corner to right bottom corner. www.easycodebook.com */ #include <stdio.h> int main() { int sqmatrix[10][10]; int i,j,m,sum=0; printf(“The… Read More »

 472 total views,  2 views today

C Program Matrix Input Output

C Program Matrix Input Output /* Write a C program to input a m x n matrix and displaying in matrix format www.easycodebook.com */ #include <stdio.h> int main() { int matrix[10][10]; int i,j,m,n; printf(“Enter number of Rows [10 Maximum]:”); scanf(“%d”,&m); printf(“Enter number of Columns [10 Maximum:]:”); scanf(“%d”,&n); printf(“\nEnter %d matrix elements in %d x %d… Read More »

 2,266 total views,  3 views today

C Program Binary to Decimal Number

C Program Binary to Decimal Number Converter   /* Write a C program to input a binary number, and convert into correspondin Decimal number www.easycodebook.com */ #include<stdio.h> #include<math.h> int main() { long int binNum,rem,n,i,decimal; printf(“Enter a Binary Number:”); scanf(“%ld”,&binNum); i=0; decimal=0; for(n=binNum;n!=0;n=n/10) { rem=n%10; decimal=decimal+rem*pow(2,i); i++; } printf(“Decimal Number:%ld “,decimal); return 0; } Output 1:… Read More »

 719 total views,  8 views today

C Program Find Larger Value between Two variables

C Program Find Larger Value between Two variables /* Find larger value between two variable www.easycodebook.com */ #include<stdio.h> int main() { int n1,n2; printf(“Enter value of N1: “); scanf(“%d”,&n1); printf(“Enter value of N2: “); scanf(“%d”,&n2); if(n1>n2) printf(“N1 is larger”); else if(n2>n1) printf(“N2 is larger”); else printf(“Both numbers are equal”); return 0; } Output 1: Enter… Read More »

 447 total views

C Program Find Teranspose Matrix

C Program Find Teranspose Matrix   /* C program to find Transpose of a Matrix www.easycodebook.com */ #include <stdio.h> int main() { int m, n, i, j, matrix1[10][10], transpose[10][10]; printf(“Enter the number of rows and columns of the matrix[Maximum 10]:\n”); scanf(“%d%d”, &m, &n); printf(“Please Enter %d elements Row wise in (%d rows x %d columns)… Read More »

 327 total views,  2 views today

C Program Subtract Two Matrices

C Program Subtract Two Matrices /* C program to subtract two matrices www.easycodebook.com */ #include <stdio.h> int main() { int m, n, i, j, matrix1[10][10], matrix2[10][10], subtraction[10][10]; printf(“Enter the number of rows and columns of matrix\n”); scanf(“%d%d”, &m, &n); printf(“Please Enter %d elements of first matrix\n”,m*n); for (i = 0; i < m; i++) for… Read More »

 998 total views,  7 views today