C program addition of 2 numbers


















In this article, you will learn and get code about how to add two numbers in C. Here are the list of ways that is used here in this article to add two numbers in C:. First, we will learn about adding two numbers of Integer type. To add two numbers in C programming, ask from user to enter any two numbers.

Place the addition of entered two number in a third variable of same data type. Finally print the value of third variable. As the above program was written under Code::Blocks IDE, therefore here is the initial snapshot of sample run:. Now supply any two number say 10 and 20 , then press ENTER key to see the output as shown in the second snapshot of same sample run:. The above program is only applicable for integer value.

If user supply any two number that contains decimal, then above program will not applicable in that case. Course Index Explore Programiz. Popular Tutorials Data Types in C. C for Loop. Arrays in C Programming. Pointers in C. Find roots of a quadratic equation. Print Pyramids and Patterns. Check prime number. Print the Fibonacci series. Reference Materials string. Start Learning C. Explore C Examples. C Examples Swap Two Numbers. Find the Size of int, float, double and char.

Compute Quotient and Remainder. Multiply Two Floating-Point Numbers.



0コメント

  • 1000 / 1000