2dix-The Student Choice
Log in Register now

Term Paper of SCIENTIFIC CALCULATOR in C Programming

The calculator was written by Rolf  Howarth in early 1996. A fully featured scientific calculator with proper operator precedence is implemented, including trig functions and logarithms, factorials, 12 levels of parentheses, logs to base 2 (a handy function for information entropists!), bitwise logical operators, hex, octal, binary and ASCII display.  

The calculator is written in JavaScript and you are welcome to view the JavaScript source (visible within the HTML page) for personal educational purposes as long as you recognize that it is copyrighted and not in the public domain. This calculator is now available as part of hummingbird's Enterprise Information Portal. All enquiries regarding licensing the calculator should be directed to Hummingbird Ltd.

                                                          USING FUNCTION

In my software program used following types of functions:-

  1. PRINTF function: - This function used for display the given data by the user through the keyboard.
  2. SCANF function:- This function used for input the data by the user.
  3. IF & ELSE statement:- This function used for check the condition where the condition is true, executed the body of true block and if the true condition is false else body will be executed.
  4. SWITCH statement:- It is used for generally for menu driven program, while using this function user directly go to the case where the user want to go, respected body will be executed.
  5. BREAK statement:- It is used for getting out from the switch case.
    1. Header files

Ex. <stdio.h>,<conio.h> etc.

  1. Switch case

Ex. Case1,case2.

1.3.     Break

  1.       Function

Ex. Void.

  1.       Control statement

Ex. And, or,not etc.

  1.       logical statement

Ex. If,ifelse,nestedif etc.

Basic Functions

Addition

The addition (sum function) is used by clicking on the "+" button or using the keyboard. The function results in a+b.

Subtraction

The subtraction (minus function) is used by clicking on the "-" button or using the keyboard. The function results in a-b.

Multiplication

The multiplication (times function) is used by clicking on the "x" button or using the keyboard "*" key. The function results in a*b.

Division

The division (divide function) is used by clicking on the "/" button or using the keyboard "/" key. The function results in a/b.

Square

The square function is used by clicking on the "x^2" button or type "^2". The function results in x*x.

Square Root

The square root function is used by clicking on the "x" button or type "sqrt()". This function represents x^.5 where the result squared is equal to x.

Raise to the Power

The raise to the power (y raised to the x function) is used by clicking on the "y^x" button or type "^".

Natural Exponential

The natural exponential (e raised to the x) is used by clicking on the "e^x" button or type "exp()". The result is e (2.71828...) raised to x.

Logarithm

The logarithm (LOG) is used by clicking on the "LOG" button or type "LOG()".

Natural Logarithm

The Natural logarithm (LN) is used by clicking on the "LN" button or type "LN()".

Inverse

Multiplicative inverse (reciprocal function) is used by pressing the "1/x" button or typing "inv()". This function is the same as x^-1 or dividing 1 by the number.

Factorial

The Factorial function is used by clicking the "!" button or type "!". 

 : C Program CODING :

#include<stdio.h>

#include<conio.h>

#include<math.h>

void main()

{

int i,y;

clrscr();

printf("** Hii friends! AYUSH WELCOMES U TO THE WORLD OF CALCULATION**");

do{

printf(" \n     ****PLEASE 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}  TRIGNOMETRIC FUNCTIONS");

printf("\n  {10} LOGARITHM");

printf("\n  {11} EXPONENTIAL");

printf("\n  { 0}  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("QUOTIENT=%d",quotient);

printf("\nREMAINDER=%d",remainder);

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:

{

int l;

float r=0.5,squareroot;

printf("ENTER THE VALUE OF WHICH WE HAVE TO FIND SQUARE ROOT  ");

scanf("%d",&l);

squareroot=pow(l,r);

printf("THE SQUARE ROOT =%.2f",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 o,p,q;

long int fact=1;

printf("ENTER THE VALUE FOR WHICH WE HAVE TO FIND FACTORIAL  ");

scanf("%d",&o);

for(p=1;p<=o;p++)

{

fact=fact*p;

}

printf("FACTORIAL =%d",fact);

break;

}

case 9:

{

int v;

 

printf("plese enter trignometric function you want to use");

printf("\n {1} sin function");

printf("\n {2} cos function");

printf("\n {3} tan function");

printf("\n {4} cosec function");

printf("\n {5} sec function");

printf("\n {6} cot function");

printf("\nplease enter value\n");

scanf("%d",&v);

 

switch(v)

{

case 1:

{

int s;

float t,u;

printf("enter degree\n");

scanf("%d",&s);

t=(s*3.14285)/180;

u=sin(t);

printf("\nsin of this degree =%.2f",u);

break;

}

case 2:

{

int s;

float t,u;

printf("enter degree\n");

scanf("%d",&s);

t=(s*3.14285)/180;

u=cos(t);

printf("\ncos of this degree =%.2f",u);

break;

}

case 3:

{

int s;

float t,u;

printf("enter degree\n");

scanf("%d",&s);

t=(s*3.14285)/180;

u=tan(t);

printf("\ntan of this degree =%.2f",u);

break;

}

case 4:

{

int s;

float t,u;

printf("enter degree\n");

scanf("%d",&s);

t=(s*3.14285)/180;

u=1/(sin(t));

printf("\ncosec of this degree =%.2f",u);

break;

}

case 5:

{

int s;

float t,u;

printf("enter degree\n");

scanf("%d",&s);

t=(s*3.14285)/180;

u=1/(cos(t));

printf("\nsec of this degree =%.2f",u);

break;

}

case 6:

{

int s;

float t,u;

printf("enter degree\n");

scanf("%d",&s);

t=(s*3.14285)/180;

u=1/(tan(t));

printf("\ncot of this degree =%.2f",u);

break;

}

}

break;

}

case 10:

{

int s;

printf("\nPlease enter base as 10 or e");

printf("\n {1} base 10");

printf("\n {2} base e");

scanf("%d",&s);

switch(s)

{

case 1:

{

float v,u;

printf("\nEnter value whoes logarithm you want to calculate in base 10\n");

scanf("%f",&u);

v=(log(u))/2.303;

printf("logarithm of this value=%.4f",v);

break;

}

case 2:

{float v,u;

printf("\nenter value whoes logarithm you want to calculate in base e\n");

scanf("%f",&u);

v=(log(u));

printf("logarithm of this value=%.4f",v);

break;

}

}

break;

}

case 11:

{

float p,q;

printf("please enter no.");

scanf("%f",&p);

q=exp(p);

printf("exp of this value=%f",q);

break;

}

case 0:

printf("Do u want to exit???");

}

printf("\nPLEASE ENTER 1 FOR CONTINUE OR 0 FOR EXIT\n");

scanf("%d",&y);

}while(y!=0);

printf("\n****THANK U, BYE-BYE****");

printf("\n**HAVE A NICE TIME**\n");

getch();

}

FUTURE SCOPE OF PROJECT:

 My project is calculator. It will surely help in calculating the calculations .  It will reduce manual labour and will be more machine oriented, thus will also help in reducing large calculation easly . It will reduce manual labour for calculating the scientific calculation.   It will be very good project in the future.

Because of:-

1. It is very simple to use.

2. It is user friendly.

3. We can  simply perform a calculation .

For Download Click Here 

SCIENTIFIC CALCULATOR

 

comments (0)

avatar