C program to demonstrate Arithmetic Operations
Arithmetic operators in the c programming language,
Addition (+) , Subtraction(-),Multiplication (*) , Division (/) and Modulus (%)
In this program, we have demonstrated the
problems with using all arithmetic Operator
#include
<stdio.h>
#include<conio.h>
void
main()
{
int a = 6,b = 2, c;
clrscr();
printf("A=6 and B=2: \n");
c = a+b;
printf("a+b = %d \n",c);
c = a-b;
printf("a-b = %d \n",c);
c = a*b;
printf("a*b = %d \n",c);
c = a/b;
printf("a/b = %d \n",c);
c = a%b;
printf("Remainder when a divided by b
= %d \n",c);
getch();
}
=============================
OUTPUT:-
A=6
and B=2:
a+b
= 8
a-b
= 4
a*b
= 12
a/b
= 3
Remainder
when a divided by b = 0
Comments
Post a Comment