Professional Documents
Culture Documents
TERM PAPER
TOPIC: CALCULATOR
1.INTRODUCTION
2.INTRODUCTION OF PROJECT
3. PROPOSED SYSTEM
(i) DESCRIPTION
3. REQUIREMENTS ANALYSIS
4. USING FUNCTIONS
5. SOURCE CODE
7. BIBLIOGRAPHY
Introduction:
C is a programming language developed at AT & T’s Bell
Laboratories of USA in 1972. It was designed and written by a
man named Dannis Ritchie. In the late seventies C began to
replace the more familiar language of that time like PL/I, ALGOL,
etc. No one pushed C. It was not made the ‘official’ Bell Labs
language. Thus, without any advertisement, C’s reputation
spread and its pool of users grew. Ritchie seems to have been
rather surprised that so many programmers preferred C to older
language like FORTRAN or PL/I, or the newer ones like Pascal
and APL. But, that’s what happened.
(a) I believe that nobody can learn C++ or Java directly. This is
because while learning these languages you have things
like classes, objects, inheritance, polymorphism, templates,
exception handling, references, etc. do deal with apart from
knowing the actual language elements. Learning these
complicated concepts when you are not even comfortable
with the basic language elements is like putting the cart
before the horse. Hence one should first learn all the
language elements very thoroughly using C language
before migrating to C++, C# or Java. Though this two step
learning process may take more time, but at the end of it
you will definitely find it worth the trouble.
Introduction of project:
PROPOSED SYSTEM
DESCRIPTION:
My software deals with calculator. I have used various
decision statements like switch, if and else and various
functions. C language really proved to be very helpful in
building of my software as it is very user friendly and is
structured language. It allows the programmer to work in
small modules called functions. Thus my software will help
in reducing the various scientific calculation.
SYSTEM REQUIREMENTS:
• Up to 6MB L2 cache
can process. All other things being equal, the more bits your
computer
processes 32 bits at a time while the other processes 16, the 32-
bit
computer will be about twice as fast.
USING FUNCTION
In my software program used following types of functions:-
Ex. Case1,case2.
1.3. Break
1.4 Function
Ex. Void.
SOURCE CODE
#include<stdio.h>
#include<conio.h>
#include<iostream.h>
#include<math.h>
#include<process.h>
#include<stdlib.h>
void main()
{
clrscr();
int i;
printf("**** WELCOME TO THE CALCULATION WORLD ****");
printf(" \n****NOW CHOOSE ONE OF THE FOLLOWING OPTIONS ****");
printf("\n {1} ADDDITION ");
printf("\n {2} SUBTRACTION ");
printf("\n {3} MULTIPLICATION ");
printf("\n {4} DIVIDE ");
printf("\n {5} POWER ");
printf("\n {6} SQUAREROOT");
printf("\n {7} INVERSE");
printf("\n {8} FACTORIAL");
printf(“\n {9} EXIT “);
printf("\n PLEASE ENTER THE VALUE \n");
printf(" ");
scanf(" %d",&i);
switch(i)
{
case 1:
int a,b,z,sum=0;
printf("\n ENTER FIRST NUMBER ");
scanf("%d",&a);
printf("\n ENTER SECOND NUMBER ");
scanf("%d",&b);
z=a+b;
sum=z;
printf("\nSUM IS %d",sum);
break;
case 2:
int c,d,subtraction=0;
printf("\n ENTER FIRST NUMBER ");
scanf("%d",&c);
printf("\n ENTER SECOND NUMBER ");
scanf("%d",&d);
if(c>d)
{
subtraction=c-d;
printf("SUBTRACTION IS =%d",subtraction);
}
else
{
subtraction=d-c;
printf("SUBTRACTION IS -%d",subtraction);
}
break;
case 3:
int e,f,multiplication=0;
printf("ENTER THE FIRST NUMBER ");
scanf("%d",&e);
printf("\nENTER SECOND NUMBER ");
scanf("%d",&f);
multiplication=e*f;
printf("MULTIPLICATION IS =%d",multiplication);
break;
case 4:
int g,h,remainder=0,quotient=0;
printf("ENTER THE FIRST NUMBER ");
scanf("%d",&g);
printf("\nENTER SECOND NUMBER ");
scanf("%d",&h);
remainder=g%h;
quotient=g/h;
printf("REMAINDER=%d",remainder);
printf("\nQUOTIENT=%d",quotient);
break;
case 5:
int j,k,power=0;
printf("FIRST NUMBER IS BASE AND SECOND IS POWER\n");
printf("ENTER FIRST NUMBER ");
scanf("%d",&j);
printf("\nENTER SECOND NUMBER ");
scanf("%d",&k);
power=pow(j,k);
printf("POWER VALUE IS=%d",power);
break;
case 6:
float l,squareroot=0;
printf("ENTER THE VALUE OF WHICH WE HAVE TO FIND SQUARE ROOT
");
scanf("%d",&l);
squareroot=sqrt(l);
printf("THE SQUARE ROOT =%d",squareroot);
break;
case 7:
float m;
float n;
printf("ENTER THE VALUE FOR WHICH WE HAVE TO FIND INVERSE ");
scanf("%f",&m);
n=1/m;
printf("INVERSE IS =%f",n);
break;
case 8:
int fact=1,o,p,q;
case 9:
exit(0);
default:
printf("PLEASE ENTER THE VALID OPTION !");
sound(1000);
getch();
}
TESTING
THE OUTPUT OF MY PROJECT
{1} ADDITION
{2} SUBTRACTION
{3} MULTIPLICATION
{4} DIVIDE
{5} POWER
{6} SQUARE ROOT
{7} INVERSE
{8} FACTORIAL
{9} EXIT
Because of:-
2. It is user friendly.
BIBLIOGRAPHY
www.en.wikipedia.org
Google search
Let Us C By “YASHAVANT KANETKAR”
Programming in ANSIC BY “BALGOLSWAMIN”
Programming in C BY “TATA MACGRAWAL PUB.”