Home / Programs / Write a program to demonstrate the results obtained by using the arithmetic operators on integer and floating point number.
Programming Example

Write a program to demonstrate the results obtained by using the arithmetic operators on integer and floating point number.

👁 1,004 Views
💻 Practical Program
📘 Step by Step Learning
Write a program to demonstrate the results obtained by using the arithmetic operators on integer and floating point number.

Program Code

/*
 Program: Write a program to demonstrate the results obtained by using the
  arithmetic operators on integer and floating point number.  
  
 Author: www.atnyla.com  
 
*/



#include "stdio.h" 
int main()
{
	int a = 25;
	int b = 2;
	int result;
	float c = 25.0;
	float d = 2.0;
	
	printf("6 + a / 5 * b = %d \n", 6 + a / 5 * b);
	printf("a / b * b = %d\n", a / b * b);
	printf("c / d * d = %f\n", c / d * d);
	printf("-a = %d\n",-a);
	
	return 0;
}

Output

6 + a / 5 * b = 16
a / b * b = 24
c / d * d = 25.000000
-a = -25
Press any key to continue . . .

Explanation

None

How to learn from this program

First read the algorithm, then study the program code line by line. After that, compare the code with the output and finally go through the explanation. This approach helps learners understand both the logic and the implementation properly.