Arithmetic Operators and Operations – Verification in C Language

We all know that Arithmetic operators are used to performing arithmetic operations in C programming language. Before starting verification program here is a list of operators and their functions and examples.

[divider]

Basic Arithmetic Operators

Operator: +
Meaning: Addition Operator
Example: 10 + 20 = 30
[divider]
Operator: -
Meaning: Subtraction Operator
Example: 20 - 10 = 10
[divider]
Operator: *
Meaning: Multiplication Operator
Example: 20 * 10 = 200
[divider]
Operator: /
Meaning: Division Operator
Example: 20 / 10 = 2
[divider]
Operator: %
Meaning: Modulo Operator
Example: 20 % 6 = 2
[divider]

Below is the very basic C language program for the verification of arithmetic operation and it's operation.

Arithmetic Operations in C

/* C Program to Verify Arithmetic Operator and Operation */
#include <stdio.h>
int main()
{
int num1,num2;
int sum,sub,mult,div,mod;
printf("\nEnter First Number :"); scanf("%d",&num1);
printf("\nEnter Second Number :"); scanf("%d",&num2);
sum = num1 + num2;
printf("\nAddition is : %d",sum);
sub = num1 - num2;
printf("\nSubtraction is : %d",sub);
mult = num1 * num2;
printf("\nMultiplication is : %d",mult);
div = num1 / num2;
printf("\nDivision is : %d",div);
mod = num1 % num2;
printf("\nModulus is : %d",mod);
return(0);
}

[divider]

OUTPUT
Enter First Number: 20
Enter Second Number: 6
Addition is: 26
Subtraction is: 14
Multiplication is: 120
Division is: 3.3333333 /* Using float in the above program displays decimal values too. */
Modulus is: 2

Rabins Sharma Lamichhane

Rabins Sharma Lamichhane is the owner of RabinsXP who is constantly working for increasing Internet of Things (IoT) in Nepal. He also builds android apps and crafts beautiful websites. He is also working with various social services. The main aim of Lamichhane is to digitally empower the citizens of Nepal and make the world spiritually sound better both in terms of technology and personal development.

Leave a Reply

Your email address will not be published. Required fields are marked *

fifteen − 12 =

%d bloggers like this: