Fri May 18 2018
Calculation
C Programming1014 views
File Name: Arithmetic-operations-in-c.c
#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
*/
Author:Geekboots