Professional Documents
Culture Documents
Society’s
Rajarambapu Institute of Technology, Rajaramnagar
Diploma
Report on
“Prepare a report on develop a simple calculator to perform mathematical
operations”
Submitted By:
Om Latane :-2373051
Name:- Sign:-
Om Latane :-2373051
Diploma
Certificate
This is to certify that the micro-project report entitled “Prepare a report on
develop a simple calculator to perform mathematical operations” submitted by following
students of class FY Computer Engineering (Diploma) for partial fulfilment of the
requirement of ‘ Programming in C (312303)’course under Maharashtra State Board of
Technical Education, Mumbai curriculum, for the year 2023-24, First Semester in the record
of their own work carried out under my direct supervision and guidance.
Om Latane :-2373051
Yours Sincerely,
Om Latane :-2373051
Particulars Page
Sr No . No.
1 Title Page 1
2 Introduction 2
5 Output 6-7
7 Applications of program 9
8 Conclusion 10
9 References 11
Introduction
Creating a calculator using C programming requires understanding of
mathematical operations and user interface. It involves designing a
program for efficient arithmetic operations and user-friendly
interactivity.
In the C of programming, calculators serve as indispensable tools for
performing mathematical calculations efficiently. Building your own
calculator program not only enhances your understanding of
fundamental programming concepts but also provides you with a
practical application to solve mathematical problems.
In this article, we will explore the process of creating a calculator
program in the C programming language. We will take you through
the step-by-step development of a calculator that can perform basic
arithmetic operations, including addition, subtraction, multiplication,
and division. Additionally, we will expand the functionality by
incorporating more advanced operations, such as exponentiation and
square root calculations.
Throughout the article, we will provide clear explanations and code
examples, making it accessible for both beginners and experienced
programmers. By following along, you will gain a deeper
understanding of core programming concepts, such as user input,
control flow, and function implementation.
Subtraction
Enabling users to perform subtraction with precision and error
handling.
Multiplication
Designing a reliable method for multiplying numbers while
considering memory optimization.
Division
Creating a division feature with error handling for edge cases such as
zero division.
In this program, four separate functions (add, subtract, multiply, and
divide) are defined to perform the corresponding arithmetic
operations. The main function prompts the user to enter an operator
(+, -, *, or /) and two numbers. The switch case statement is then used
to determine the chosen operator and call the appropriate function.
The result of the calculation is stored in the result variable and
displayed on the screen. The program handles invalid operators
gracefully and terminates execution if an error occurs during division
by zero.
Implementing User Input and Output
User Input :-
Adding functionality for users to input numbers and select arithmetic
operations.
User Output :-
resource utilization.
Unit Testing :-
Conducting rigorous tests to ensure the correctness of each arithmetic
operation.
Debugging :-
User Testing :-
Gathering feedback through user testing for the calculator’s ease of
use and accuracy.
Program code :-
#include <stdio.h>
#include <conio.h>
void main()
{ char opt;
floatnum1, num2;
float result;
do {
C calculator:\n”);
scanf(“%f”, &num1);
scanf(“%f”, &num2);
break;
case ‘*’:
result= num1 *
num2;
break;
case ‘/’:
if (num2 == 0)
n”);
return 0; }
break;
default:
operator\n”); return 0; }
return result;
}
Output:-
Applications of simple calculator
https://www.scaler.com/topics/calculator-program-in-c/
https://www.upgrad.com/tutorials/software-engineering/c-tutorial/
calculatorprogram-in-c/ https://www.geeksforgeeks.org/arithmetic-
progression/