Category Archives: Basic Formula Calculation C Programs

C Program Matrix Multiplication

C Program Matrix Multiplication /* C program to multiplication two matrices Matrix Multiplication www.easyCodeBook.com */ #include <stdio.h> int main() { int m, n, p, q, i, j, k; int matrix1[10][10], matrix2[10][10], multiplication[10][10]; printf("Enter number of rows and columns of matrix1\n"); scanf("%d%d", &m, &n); printf("Enter number of rows and columns of matrix2\n"); scanf("%d%d", &p, &q); if… Read More »

C Program Print Natural Numbers First Ten

Print Natural Numbers First Ten

C Program To Calculate Circumference of Circle

Q: Write a C Program To Calculate Circumference of Circle. Input radius of the circle from the user at run time. Use the formula: circumference of circle = 2 * PI * radius The Logic Behind C Program to Find Circumference of Circle This is a simple C program using formula calculation technique. The basic… Read More »

Swap Variable Contents Using XOR Bit wise Operator

Swap Variable Contents Using XOR Bit wise Operator in a C program. This is a simple C program for exchanging values of two variables using XOR Bit wise operator ^. There is no need using a third variable for the above mentioned swapping.   /* Write a C program to swap values of two variables… Read More »

Swap two variable values without third

Here is a C program Code to swap or exchange two variable values without third variable. This program uses a simple mathematical trick. Suppose we have two variables with values: num1 =10, num2 = 20 num1 = num1 + nm2        => num1 =10+20 = 30 num2 = num1 -num2      =>… Read More »

C Code To Swap Values of Two Variables

This is a simple C Code To Swap Values of Two Variables using a third temporary variable. This C code uses simple assignment statements to swap the values. We will use a third variable called temp to exchange values of two variables. First we save the value of first variable in temp variable. Now we… Read More »

Fahrenheit to Celsius Conversion C Program

This is a C language program for Fahrenheit to Celsius Conversion. It converts Fahrenheit to Celsius using formula:Celsius = (Fahrenheit – 32) * 5.0 /9.0 /*Write a C program to Convert Fahrenheit into Celsius*/#include <stdio.h> int main() { float fahren, celsius; printf(“Enter temperature in Fahrenheit=”); scanf(“%f”, &fahren); celsius = (fahren-32)*5.0 / 9.0; printf(“%.2f Fahrenheit is… Read More »

Convert Person Height from Inches to Centimeters

Today we will write a C language program to convert person height from inches to centimeters. This is a simple formula calculation program. The following is the formula: centimeters = inches x 2.54. /* C Program to convert person’s height from inches to centimeters using formula 2.54 * height */ #include<stdio.h> int main() { float… Read More »

Degree Celsius to f conversion program

“Degree Celsius to f conversion” program will compute Fahrenheit temperature. This program takes temperature in Celsius degrees. The popular formula for Degree Celsius to f conversion is: f = 9/5 x c + 32   /* Write a C Program to input temperature in Celcius and converts it into Fahrenheit formula is f = 9/5… Read More »

C Program Compute Distance Covered By Car

This is a basic C Programming language program. It is a formula calculation example program in C language. This program uses the following statements: First line starts with Pre processor directives Pre processor directives will include required header file/s. It uses scanf() function for input. We use printf() function for output This program uses assignment… Read More »