Skip to content

Instantly share code, notes, and snippets.

@aishaon
Created October 13, 2019 14:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aishaon/6a4403e66c31ccc4fc2e2df9de4df8c1 to your computer and use it in GitHub Desktop.
Save aishaon/6a4403e66c31ccc4fc2e2df9de4df8c1 to your computer and use it in GitHub Desktop.
Arithmetic Operators in C
#include <stdio.h>
int main() {
//Arithmetic operators
int num1 = 10, num2 = 21;
float sum;
//summation
sum = num1 + num2;
printf("The summation of %d and %d is: %f\n\n", num1, num2, sum);
//subtraction
sum = num2 - num1;
printf("The subtraction of %d and %d is: %f\n\n", num2, num1, sum);
//multiplication
sum = num1 * num2;
printf("The multiplication of %d and %d is: %f\n\n", num1, num2, sum);
//division
sum = num2 / num1;
printf("The division of %d and %d is: %f\n\n", num2, num1, sum);
//modulus
sum = num2 % num1;
printf("The modulus of %d and %d is: %f\n\n", num2, num1, sum);
getch();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment