In the C programming language, integer arithmetic operations are performed using basic arithmetic operators. Here's a quick overview:
/* Integer arithmetic operations*/ #include<stdio.h> int main(void) { int a=17,b=4; printf("Sum=%d\n",a+b); printf("Difference=%d\n",a-b); printf("Product=%d\n",a*b); printf("Quotient=%d\n",a/b); printf("Remainder=%d\n",a%b); return 0; }
The given C code performs basic integer arithmetic operations on the variables a and b. Here's the expected output:
Sum=21 Difference=13 Product=68 Quotient=4 Remainder=1
Explanation:
- Sum:
- Difference:
- Product:
- Quotient: (integer division, so the fractional part is truncated)
- Remainder: (remainder when 17 is divided by 4)
Comments
Post a Comment