How to Perform Basic Arithmetic Operation in C Program

0
869

There are five fundamental arithmetic operators found in C language, which are addition(+), subtraction(-), multiplication(-), division(/) and modulus(%) of two numbers. All arithmetic operators usually compute the result of particular arithmetic operation and returns its result.

This program performs essential paired number juggling operation on two whole number operands like expansion, subtraction, division and modulus and prints result in screen. It first takes two whole numbers as contribution from client utilizing scanf capacity and stores them in “firstNumber” and “secondNumber” int factors and performs expansion, subtraction, increase, division and modulus operations and stores brings about ‘entirety’, “difference” , ‘item’, “remainder” and “modulo” factors individually. Next, it prints the outcome on screen utilizing printf work.Here is a program on How to perform addition, subtraction, multiplication and division in C program.

Program Output

Enter First Number: 25 Enter Second Number: 4 Sum = 29 Difference = 21 Multiplication = 100 Division = 6.250 Remainder = 1

Relational Operator

These operators are utilized as a part of making a correlation between two amounts or take certain choices. For example, a social administrator thinks about the age of two individuals or the cost of two things.

a<b or a<30 is called social expression and the esteem is it is possible that one or zero or genuine or false, separately.

Logical Operators

This logical apparatus can be used in a program to test if the condition is true or forc

Logical operators are utilized to assess complex standard expressions and are utilized as a part of mixes with social administrators to test at least one conditions and decide. C has three logical Operators:

&&: It is logical AND operator. When both operands are not-zero, then the condition becomes true

||: It is called OR logical operator. If one of the two operands is not-zero, then the condition usually becomes true.!: It is Logical NOT and is utilized to change the logical state of the operand. If the condition is 1 the NOT operator can make it false and vice versa.

LEAVE A REPLY

Please enter your comment!
Please enter your name here