C program to print the addition of two numbers. The user is requested to enter two integers in this example. The sum of these two integers is then computed and shown on the screen. You should be familiar with the following C programming subjects, such as basic c programs, in order to comprehend this example.
int a, b, sum;
printf("Enter two integers");
scanf("%d %d", &a, &b);
sum = a + b;
printf("%d + %d = %d", a, b, sum);
Enter two integers 45
45 + 45 = 90
How to print the addition of two numbers in c
In this application, Printf() displays the text Hello World on the screen. The user is requested to enter two integers in this software. Variables a and b are used to store these two integers. Then, using the + operator, these two values are added, and the result is saved in the sum variable.
What is operator in c programming and uses of arithmetic operator
A symbol that directs the compiler to execute particular mathematical or logical operations is known as an operator. The C programming language has a large number of built-in operators, including the following: Arithmetic Operators It contains addition, subtraction, multiplication, division, modulus operations, increment, and decrement, as well as other fundamental arithmetic operations.
Mathematical computations are carried out using arithmetic operators. The assignment operators are used to give a property or variable a value. Numeric, date, system, time, and text can all be used as assignment operators. To accomplish comparisons, comparison operators are employed.