0% found this document useful (0 votes)
10 views6 pages

Simple C Calculator Project Overview

The document outlines a project titled 'Simple Calculator' developed by a group of students for a computer programming course. It details the program's functionality to perform basic arithmetic operations using C language, including the design, implementation, and testing phases. The project aims to enhance programming skills and understanding of fundamental concepts such as input handling and error checking.

Uploaded by

siddiquirubesha7
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views6 pages

Simple C Calculator Project Overview

The document outlines a project titled 'Simple Calculator' developed by a group of students for a computer programming course. It details the program's functionality to perform basic arithmetic operations using C language, including the design, implementation, and testing phases. The project aims to enhance programming skills and understanding of fundamental concepts such as input handling and error checking.

Uploaded by

siddiquirubesha7
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

PROJECT TITLE:

“SIMPLE CALCULATOR”
SUBMITTED BY:
MASFA IQBAL ( FD-028 )
RUBESHA SIDDIQUI ( FD-05 )
JAWERIA SHAIKH ( FD-025 )
AYESHA SHADABI ( FD-017 )
COURSE: COMPUTER PROGRAMMING (CS-103)
INSTRUCTOR: SIR ALI AKHTER
DEPARTMENT: DEPARTMENT OF FOOD ENGINEERING
SUBMISSION DATE : 26-11-2025
Table of Contents
1. Abstract
2. Introduction
2.1 Background
2.2 Problem Statement
2.3 Objectives
2.4 Scope
3. Project Description
4. Program Design
4.1 Flowchart
4.2 Algorithm
5. Implementation
5.1 Source Code
5.2 Explanation of Main Components
6. Testing and Output
6.1 Sample Test Cases
6.2 Output Screenshots

1. Abstract
This project presents a simple calculator program developed in C. The program allows the user
to perform basic arithmetic operations such as addition, subtraction, multiplication, and division.
The objective is to demonstrate fundamental programming concepts including input/output
handling, conditional statements, switch-case control structure, and basic error checking. The
calculator takes two numbers and an operator as input and produces the corresponding
mathematical result.
2. Introduction
2.1 Background
Calculators are essential tools for performing quick mathematical calculations. Developing a
basic calculator program helps beginners understand how computers process operations and how
programming logic is used to mimic real-world tools. This project serves as practice in using
core C language constructs.

2.2 Problem Statement


The problem is to design and implement a C program capable of performing basic arithmetic
operations (+, -, *, /) on two numbers entered by the user.

2.3 Objectives
 To apply programming fundamentals in developing a functional software application.
 To utilize loops, conditionals, functions, arrays, or file handling depending on project
needs (not all may apply here).
 To strengthen logic-building and coding skills.
 To gain experience in using switch-case structures and input validation.

2.4 Scope
The program performs four basic arithmetic operations. It accepts user input, processes the
operator, computes the result, and displays the output. The program does not handle advanced
features such as multiple calculations in a single run, exponentiation, or memory functions.

3. Project Description
The Simple Calculator program prompts the user to enter an operator and two numerical values.
Using a switch-case structure, it evaluates the operator and performs the corresponding
operation. The result is then printed on the screen. The program also includes basic error
handling for division by zero and invalid operators.

4. Program Design
4.1 Flowchart
Start → Input operator → Input numbers → Switch-case → Perform operation → Display
output → End
4.2 Algorithm
1. Start the program.
2. Ask the user to input an operator (+, -, *, /).
3. Ask the user to enter two numbers.
4. Use a switch-case statement to check which operator was entered.
5. Perform the corresponding arithmetic operation.
6. Display the result.
7. If division is selected, ensure the second number is not zero.
8. If an invalid operator is entered, display an error message.
9. End the program.

5. Implementation
5.1 Source Code
#include<stdio.h> #include<conio.h>
int main() { textbackground(WHITE); textcolor(BLACK); clrscr();
char operato; double first, second; printf("ENTER THE OPERATOR(+,-,*,/): ");
scanf("%c",&operato); printf("ENTER THE TWO NUMBERS one by one: ");
scanf("%lf %lf",&first,&second);
switch(operato) {
case '+': printf("%lf + %lf = %lf", first, second, (first + second));
break
case '-': printf("%lf - %lf = %lf", first, second, (first - second));
break;
case '*': printf("%lf * %lf = %lf", first, second, (first * second));
break;
case '/': if(second != 0.0) printf("%lf / %lf = %lf", first, second, (first / second));
else printf("Math error: division by zero"); break; default:
printf("Invalid operator"); } getch(); return 0;}
5.2 Explanation of Main Components
 Functions used: printf(), scanf(), switch(), getch().
 Logics: Switch-case logic is used to determine the operation.
 Conditions: If-else is used to check division-by-zero.
 Data Types: double is used for decimal values.
 User Input: Operator and two numbers are taken using scanf().

6. Testing and Output


6.1 Sample Test Cases
Test Case Input Expected Output Actual Output Status

operator: + ; numbers: 4 5 4 + 5 = 9 4+5=9 Pass

operator: - ; numbers: 10 3 10 - 3 = 7 10 - 3 = 7 Pass

operator: * ; numbers: 2 8 2 * 8 = 16 2 * 8 = 16 Pass

operator: / ; numbers: 12 4 12 / 4 = 3 12 / 4 = 3 Pass

operator: / ; numbers: 5 0 MATH Error MATH Error Pass

6.2 Output Screenshots

You might also like