Calculation

#include<stdio.h>

int main() {

	/* Declaration of integer type variable */
	int sum, sub, mul, div, mod;
	printf("Calculation in C \n");

	/* Calculation of Sum */
	sum = 1 + 2;

	/* Calculation of Subtract */
	sub = 3 - 2;

	/* Calculation of Multiplication */
	mul = 2 * 2;

	/* Calculation of Division */
	div = 4 / 2;

	/* Calculation of Modulus */
	mod = 3 % 2;

	/* Display integer value from variables */
	printf("Sum: %d\n",sum);
	printf("Subtract: %d\n",sub);
	printf("Multiplication: %d\n",mul);
	printf("Division: %d\n",div);
	printf("Modulus: %d\n",mod);

	return 0;
}


/* Output */
Calculation in C
Sum: 3
Subtract: 1
Multiplication: 4
Division: 2
Modulus: 1

Comments (0)

  • To add your comment please or

We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.

Got It!