C Program To Develop Simple Calculate

Program To Develop Calculator:

Hello friends, in this post today, we will learn how we can create a simple calculator using C programming language.
Calculator In C Programming
Let's know how to make a simple calculator in C programming language, which written below:

1. Output: 

Enter any one operator(like+,-,*,/)
+
Enter two Numbers:
6
9
6.0 + 9.0 = 15.0

2.Output:

Enter any one operator(like+,-,*,/)
-
Enter two Numbers:
6
9
6.0 - 9.0 = -3.0

3. Output:

Enter any one operator(like+,-,*,/)
*
Enter two Numbers:
6
9
6.0 * 9.0 = 54.0
4. Output:
Enter any one operator(like+,-,*,/)
/
Enter two Numbers:
12
9
12.0 / 3.0 = 4.0

For creating a simple calculator, we follow the following step, which showing in the above program.
1. First, we take preprocessor directive in the program.
For example: #include<stdio.h>
It's mean that this is Include with Standard Input Output Header File.
  1. Operators
  2. Structures
  3. Union
2. Next is, main function.
i.e., int main()
It's mean that this is Integer Main function.
3. Next is, variables declaration. In variables declaration, we decleare the variables, which define in the program.
4. Next step is printf(). printf() function uses for print(Output) to the statement on the monitor.
5. Next is, scanf() function. This function used for read(input) two variable.
In this program %c uses for read the character data type and & (address operator) is address of oprtr.
6. In the next step, we use switch statement which is a decision making statements, which allow us to control operators in the program like (+,-,*,/).
In the output, which operator we enter will perform the same.

Post a Comment

2 Comments