SlideShare a Scribd company logo
1 of 9
TO DESIGN A CALCULATOR USING C LANGUAGE

BY- SAURABH KHETAN




     1   2   3   +
     4   5   6   -
     7   8   9   *
     0   =   %   /
 Hello friends, my name is Saurabh Khetan.


 This time i am here with a presentation showing you to
  design your own calculator using a console application.

 The calculator over here is designed using a basic
  programming language i.e C language.

 Programming of the calculator is tested on the Microsoft
  visual C++ express.

 It is a software use to code the C programs.


 As I have mentioned in my earlier presentation of prime
  numbers, the same program can be coded, compiled and
  executed in turbo C++ as well.
 Our calculator is a simple calculator capable of
  performing operations on two numbers.

 The numbers might be decimal or non-decimal.

 User is allowed to enter the desired numbers and the
  result will be displayed on the screen.

 The calculator will perform four basic operations of
  addition, subtraction, multiplication and division.

 The students interested in software engineering and want
  to learn basic programming and build their logic may
  find this program interesting.

 The program is constructed using switching method in C
  language.
 The switching method in C language provides an option
  to the user which operation he desires to perform.

 Thus, a program wherein there are too many options
  listed, the user can select a particular option and obtain
  the result of that operation.

 The switch case in C programming can be done using a
  very simple set of syntaxes.

 Now we move to our first switch case program in C
  language.

 It will clarify our doubts about the design of our C
  program.
#include<stdio.h>
int main()
{
/*This is a calculator programme. Calculator is able to perform the operation of two numbers*/
int num;float a,b,c;
printf("Hello friends this is a calculator ");
  printf("nchoose a number from the menu to operate the desired function");
printf("npress 1 for additionnpress 2 for subtractionnpress 3 for multiplicationnpress 4 for division");
scanf("%d",&num);
/*The operation is performed using the switch case method*/
switch(num)
{
case 1:
printf("enter two numbers");
scanf("%f%f",&a,&b);
c= a+b;
printf("the addition of two numbers is %f",c);
break;
case 2:
printf("enter two numbers");
scanf("%f%f",&a,&b);
c=a-b;
printf("the subtraction of two numbers is %f",c);
break;
case 3:
printf("enter two numbers");
scanf("%f%f",&a,&b);
c=a*b;
printf("the multiplication of two numbers is %f",c);
break;
case 4:
printf("enter two numbers");
scanf("%f%f",&a,&b);
c=a/b;
printf("the division of two numbers is %f",c);
}
}
 The previous slide is the exact program to design our
 own calculator.

 The program had been written in a single slide to avoid
 the confusion of the readers.

 The program as I said had been tested and works
 efficiently.

 The text entered within /**/ are the comments in the
 program to clarify the usage and construction.

 All you need to know about this program is the basic use
 of the header files, basic functions and the syntax.

 You can just copy this program from the slide or instead
 write it in the editor of the software of your choice.
 To learn about the C language and more of it, you may go
  for the book named: Let us C by Mr. Yashavant Kanetkar.

 Or the more efficient course offered by him with the help
  of Dvds namely Quest course would be much better.

 After you written the program in the editor, build it and
  run it.

 The moment you run it you will experience the fun while
  programming.

 This program might develop your interest in the software
  area.
 So friends just enjoy this program and do feed me
 with your comments after seeing this presentation.

 And do wait for my next upload.


 For any other queries u can mail me on this address
  saurabh.khetan53@gmail.com

 Any problem regarding this program and any kind of
 query would be resolved.
Calculator using C language

More Related Content

Viewers also liked

Basics of C programming
Basics of C programmingBasics of C programming
Basics of C programmingavikdhupar
 
Java final project of scientific calcultor
Java final project of scientific calcultorJava final project of scientific calcultor
Java final project of scientific calcultorMd. Eunus Ali Rupom
 
Shipping and Storage: A New Approach
Shipping and Storage: A New ApproachShipping and Storage: A New Approach
Shipping and Storage: A New ApproachUpendra Sengar
 
C program to turn off your pc
C program to turn off your pcC program to turn off your pc
C program to turn off your pcSaurabh Khetan
 
Scientific calcultor-Java
Scientific calcultor-JavaScientific calcultor-Java
Scientific calcultor-JavaShaibal Ahmed
 
A simple snake game project
A simple snake game projectA simple snake game project
A simple snake game projectAmit Kumar
 
Using the ti 83 84
Using the ti 83 84Using the ti 83 84
Using the ti 83 84lothomas
 
Complete C programming Language Course
Complete C programming Language CourseComplete C programming Language Course
Complete C programming Language CourseVivek chan
 
Calculator and how to make it using VB 6.0
Calculator and how to make it using VB 6.0Calculator and how to make it using VB 6.0
Calculator and how to make it using VB 6.0surajkumarpadhy
 
05. Power Supply Unit (PSU)
05. Power Supply Unit (PSU)05. Power Supply Unit (PSU)
05. Power Supply Unit (PSU)Akhila Dakshina
 
Password based door lock system using 8051 microcontroller final report
Password based door lock system using 8051 microcontroller final reportPassword based door lock system using 8051 microcontroller final report
Password based door lock system using 8051 microcontroller final reportChinaraja Baratam
 
Variable power supply
Variable power supplyVariable power supply
Variable power supplyTeksify
 

Viewers also liked (14)

Basics of C programming
Basics of C programmingBasics of C programming
Basics of C programming
 
Java final project of scientific calcultor
Java final project of scientific calcultorJava final project of scientific calcultor
Java final project of scientific calcultor
 
Shipping and Storage: A New Approach
Shipping and Storage: A New ApproachShipping and Storage: A New Approach
Shipping and Storage: A New Approach
 
C program to turn off your pc
C program to turn off your pcC program to turn off your pc
C program to turn off your pc
 
Scientific calcultor-Java
Scientific calcultor-JavaScientific calcultor-Java
Scientific calcultor-Java
 
A simple snake game project
A simple snake game projectA simple snake game project
A simple snake game project
 
Java calculator
Java calculatorJava calculator
Java calculator
 
Using the ti 83 84
Using the ti 83 84Using the ti 83 84
Using the ti 83 84
 
Graphing Calculator
Graphing CalculatorGraphing Calculator
Graphing Calculator
 
Complete C programming Language Course
Complete C programming Language CourseComplete C programming Language Course
Complete C programming Language Course
 
Calculator and how to make it using VB 6.0
Calculator and how to make it using VB 6.0Calculator and how to make it using VB 6.0
Calculator and how to make it using VB 6.0
 
05. Power Supply Unit (PSU)
05. Power Supply Unit (PSU)05. Power Supply Unit (PSU)
05. Power Supply Unit (PSU)
 
Password based door lock system using 8051 microcontroller final report
Password based door lock system using 8051 microcontroller final reportPassword based door lock system using 8051 microcontroller final report
Password based door lock system using 8051 microcontroller final report
 
Variable power supply
Variable power supplyVariable power supply
Variable power supply
 

Calculator using C language

  • 1. TO DESIGN A CALCULATOR USING C LANGUAGE BY- SAURABH KHETAN 1 2 3 + 4 5 6 - 7 8 9 * 0 = % /
  • 2.  Hello friends, my name is Saurabh Khetan.  This time i am here with a presentation showing you to design your own calculator using a console application.  The calculator over here is designed using a basic programming language i.e C language.  Programming of the calculator is tested on the Microsoft visual C++ express.  It is a software use to code the C programs.  As I have mentioned in my earlier presentation of prime numbers, the same program can be coded, compiled and executed in turbo C++ as well.
  • 3.  Our calculator is a simple calculator capable of performing operations on two numbers.  The numbers might be decimal or non-decimal.  User is allowed to enter the desired numbers and the result will be displayed on the screen.  The calculator will perform four basic operations of addition, subtraction, multiplication and division.  The students interested in software engineering and want to learn basic programming and build their logic may find this program interesting.  The program is constructed using switching method in C language.
  • 4.  The switching method in C language provides an option to the user which operation he desires to perform.  Thus, a program wherein there are too many options listed, the user can select a particular option and obtain the result of that operation.  The switch case in C programming can be done using a very simple set of syntaxes.  Now we move to our first switch case program in C language.  It will clarify our doubts about the design of our C program.
  • 5. #include<stdio.h> int main() { /*This is a calculator programme. Calculator is able to perform the operation of two numbers*/ int num;float a,b,c; printf("Hello friends this is a calculator "); printf("nchoose a number from the menu to operate the desired function"); printf("npress 1 for additionnpress 2 for subtractionnpress 3 for multiplicationnpress 4 for division"); scanf("%d",&num); /*The operation is performed using the switch case method*/ switch(num) { case 1: printf("enter two numbers"); scanf("%f%f",&a,&b); c= a+b; printf("the addition of two numbers is %f",c); break; case 2: printf("enter two numbers"); scanf("%f%f",&a,&b); c=a-b; printf("the subtraction of two numbers is %f",c); break; case 3: printf("enter two numbers"); scanf("%f%f",&a,&b); c=a*b; printf("the multiplication of two numbers is %f",c); break; case 4: printf("enter two numbers"); scanf("%f%f",&a,&b); c=a/b; printf("the division of two numbers is %f",c); } }
  • 6.  The previous slide is the exact program to design our own calculator.  The program had been written in a single slide to avoid the confusion of the readers.  The program as I said had been tested and works efficiently.  The text entered within /**/ are the comments in the program to clarify the usage and construction.  All you need to know about this program is the basic use of the header files, basic functions and the syntax.  You can just copy this program from the slide or instead write it in the editor of the software of your choice.
  • 7.  To learn about the C language and more of it, you may go for the book named: Let us C by Mr. Yashavant Kanetkar.  Or the more efficient course offered by him with the help of Dvds namely Quest course would be much better.  After you written the program in the editor, build it and run it.  The moment you run it you will experience the fun while programming.  This program might develop your interest in the software area.
  • 8.  So friends just enjoy this program and do feed me with your comments after seeing this presentation.  And do wait for my next upload.  For any other queries u can mail me on this address saurabh.khetan53@gmail.com  Any problem regarding this program and any kind of query would be resolved.