C Program to perform arithmetic operations using floating point variables

This program shows different basic operations like add, subtract, multiply and divide that can be performed on floating point variables in C.

Program

#include<stdio.h>
void main()
{
	float a = 40.0;
	float b = 2.50;
	printf("%f + %f = %f\n", a, b, a + b);
	printf("%f - %f = %f\n", a, b, a - b);
	printf("%f * %f = %f\n", a, b, a * b);
	printf("%f / %f = %f\n", a, b, a / b);
}

Output

40.000000 + 2.500000 = 42.500000
40.000000 - 2.500000 = 37.500000
40.000000 * 2.500000 = 100.000000
40.000000 / 2.500000 = 16.000000