Welcome Everyone
To Our
Presentation
Topic : Scientific Calculator
Presented To:
Dr. Md Azam Hossain
CSE 103 (Section:07)
Our Team
1. Mubassir Rahman Rounak (2022-1-60-135)
2. Meghla Jahan Urme (2022-1-60-139)
3.Tasnim Saima Raita (2022-1-60-291)
TABLE OF CONTENTS
1.Introduction
2.Basic function
3.System Design
4.Source code
5.Code explanation
6.Testing
7.Future scope of project
INTRODUCTION
Scientific Calculator :
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.
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 "^".
 Factorial
The Factorial function is used by clicking the "!" button or type "!".
 Modulus
This function is used by click % button.
 Trigonometry
This function is used by clicking sin, cos, tan, sec, cosec button. It represents the
trigonometric operations.
 Pi
PI is a mathematical constant of the ratio of a circle's circumference to its diameter.
 Numeric conversion
This function is used for converting a number into binary, decimal, hexadecimal, octal.
 Expression
 Permutation combination
System Design
Then we began with the design phase of the system. System design is a
solution, a “HOW TO” approach to the creation of a new system. It
translates system requirements into ways by which they can be made
operational. It is a translational from a user oriented document to a
document oriented programmers. For that, it provides the
understanding and procedural details necessary for the
implementation. Here we use flowchart to supplement the working of
the new system. The system thus made should be reliable, durable and
above all should have least possible maintenance costs. It should
overcome all the drawbacks of the old existing system and most
important of all meet the user requirements.
Coding
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<math.h>
#define note "Enter the valid operation"
void addition();
void subtraction();
void multiplication();
void division();
void modulus();
void expressions();
void factorial_();
void power();
void squareroot();
void trigonometry();
void Permutation_Combination();
long factorial(int);
long permutation(int,int);
long combination(int,int);
void Binomial();
void Polynomial();
void Decimal();
void Hexadecimal();
void Octal();
int main()
{
int i,c=0;
char ch1[20],ch2[20],ch;
system("COLOR 0A");
printf("===================================================================================
=====================================n");
printf(" LOG IN SYSTEM n");
printf("===================================================================================
=====================================n");
printf("n");
printf("Enter Your Username : n");
gets(ch1);
printf("Enter Your Password : n");
while(1)
{
ch=getch();
if(ch==13)
break;
else if(ch==8)
{
if(c!=0)
{
printf("b");
printf("%c",32);
printf("b");
c--;
}
else
continue;
}
else
{
putchar('*');
ch2[c]=ch;
c++;
}
ch2[c]='0';
}
printf("n");
if(strcmp(ch1,"user")==0)
{
if(strcmp(ch2,"1234")==0)
{
printf("Log in Successful");
printf("npress Enter for new screen");
getch();
system("cls");
system("COLOR 5E");
printf("==========================================================================================
");
printf("n Welcome to the scientific calculator!! n");
printf("==========================================================================================
");
int choice;
printf("nnn****** Press 0 to quite the program ******nn");
printf("Enter 1 for additionn");
printf("Enter 2 for subtractionn");
printf("Enter 3 for multiplicationn");
printf("Enter 4 for divisionn");
printf("Enter 5 for modulusn");
printf("Enter 6 for expressionsn");
printf("Enter 7 for factorialn");
printf("Enter 8 for powern");
printf("Enter 9 for squarerootn");
printf("Enter 10 for trigonometryn");
printf("Enter 11 for permutation & combinationn");
printf("Enter 12 for Binomial equationn");
printf("Enter 13 for Polynomial equationn");
printf("Enter 14 for Decimal number to all base numbern")
printf("Enter 15 for Hexadecimal number to all base numbern");
printf("Enter 16 for Octal number to all base numbern");
while(1)
{
printf("nnEnter the operation you want to do: ");
scanf("%d",&choice);
switch(choice)
{
case 1:
addition();
break;
case 2:
subtraction();
break;
case 3:
multiplication();
break;
case 4:
division();
break;
case 5:
modulus();
break;
case 6:
expressions();
break;
case 7:
factorial_();
break;
case 8:
power();
break;
case 9:
squareroot();
break;
case 10:
trigonometry();
break;
case 11:
Permutation_Combination();
break;
case 12:
Binomial();
break;
case 13:
Polynomial();
break;
case 14:
Decimal();
break;
case 15:
Hexadecimal();
break;
case 16:
Octal();
break;
case 0:
exit(0);
default:
printf("n********** %s **********n",note);
}
}
}
else
printf("Password was Wrong !!");
}
else
printf("Username was Wrong !!");
getch();
}
void addition()
{
int m,i,A[100],sum=0;
printf("Enter the size of array : ");
scanf("%d",&m);
printf("Enter the elements of array : ");
for(i=0; i<m; i++)
{
scanf("%d",&A[i]);
}
printf("Sum of the elements : ");
for(i=0; i<m; i++)
{
sum=sum+A[i];
}
printf("%d",sum);
}
void subtraction()
{
int a, b;
printf("Enter the numbers you want to subtract : ");
scanf("%d%d",&a,&b);
printf("The subtraction of a and b is %d",a-b);
}
void multiplication()
int m, i, A[100], mul=1;
printf("Enter the size of array : ");
scanf("%d",&m);
printf("Enter the elements of array : ");
for(i=0; i<m; i++)
{
scanf("%d",&A[i]);
}
printf("Multiplication of the elements : ");
for(i=0; i<m; i++)
{
mul=mul*A[i];
}
printf("%d",mul);
}
void division()
{
int a, b;
printf("Enter the numbers you want to devide : ");
scanf("%d%d",&a,&b);
printf("The division of a and b is %f",(float)a/(float)b);
}
void modulus()
int precedence(char a,char b)
{
if(((a=='+')||(a=='-'))&&((b=='*')||(b=='/')))
return 0;
else
return 1;
}
char expr[20];
char stack[20];
int i;
int ctr;
int top=-1;
int topOper=-1;
int operate(int a,int b,char oper)
{
int res=0;
switch(oper)
{
case '+':res=a+b;break;
case '-':res=a-b;break;
case '*':res=a*b;break;
case '/':res=a/b;break;
}
return res;
}
void postfixConvert()
{
char topsymb,operatorStack[20];
ctr=0;
while(expr[ctr]!='0')
{
if(expr[ctr]>='0'&&expr[ctr]<='9')
stack[++top]=expr[ctr];
else
{
while(topOper>=0&&precedence(operatorStack[topOper],expr[ctr]))
{
topsymb=operatorStack[topOper--];
stack[++top]=topsymb;
}
operatorStack[++topOper]=expr[ctr]
}
ctr++;
}
while(topOper>=0)
stack[++top]=operatorStack[topOper--];
}
void expressions()
{
printf("Enter the Expressionn");
scanf("%s",&expr);
postfixConvert();
char oper;
int operand1,operand2;
ctr=0;
int result[2];
int rTop=-1;
while(stack[ctr]!='0')
{
oper=stack[ctr];
if(oper>='0'&&oper<='9')
result[++rTop]=(int)(oper-'0');
else
{
operand1=result[rTop--];
operand2=result[rTop--];
result[++rTop]=operate(operand2,operand1,oper);
}
ctr++;
}
printf("The result of the expression isn%dn",result[0]);
getch();
}
void factorial_()
{
int n, i, fact;
printf("Enter the number you want the factorial of : ");
scanf("%d",&n);
fact=1;
for(i=1; i<=n; i++)
{
fact=fact*i;
}
printf("Factorial of %d is %d",n,fact);
}
void power()
{
double x, n, p;
printf("Enter the base number: ");
scanf("%lf", &x);
printf("Enter the power: ");
scanf("%lf",&n);
p = pow(x,n);
printf("%.1lf^%.1lf = %.2lf", x, n, p);
return 0;
}
void squareroot()
{
double number, squareroot;
printf("Enter a number: ");
scanf("%lf", &number);
squareroot = sqrt(number);
printf("Square root of %.2lf = %.2lf", number, squareroot);
return 0;
}
void trigonometry()
{
float n, p;
printf("Enter angle in degree: ");
scanf("%f",&n);
p = n * (3.1416/180);
printf("Sin(%.2f) = %.2f",n,sin(p));
printf("nCos(%.2f) = %.2f",n,cos(p));
printf("nTan(%.2f) = %.2f",n,tan(p));
printf("nCot(%.2f) = %.2f",n,1/tan(p));
printf("nSec(%.2f) = %.2f",n,1/cos(p));
printf("nCosec(%.2f) = %.2f",n,1/sin(p));
return 0;
}
void Permutation_Combination()
{
int n, r;
long npr, ncr;
printf("Enter the value of n and r : ");
scanf("%d%d", &n, &r);
npr = permutation(n, r);
ncr = combination(n, r);
printf("n%dP%d = %ld", n, r, npr);
printf("n%dC%d = %ld", n, r, ncr);
return 0;
}
long permutation(int a, int b)
{
return (factorial(a)/(factorial(a-b)));
}
long combination(int a, int b)
{
return (factorial(a)/(factorial(b)*(factorial(a-b))));
}
long factorial(int c)
{
if(c == 1|| c==0)
return 1;
else
return c*factorial(c-1);
}
void Binomial()
{
int s=0;
printf("Enter the binomial order : ");
scanf("%ld", &s);
while (s < 0)
{
printf("Please enter positive binomial order : ");
scanf("%d", &s);
}
printf("(a+b)^%ld =",s);
printf("n");
for(int k = 0; s >= k; k++)
{
calculate(k);
printf("n");
}
return 0;
}
void print(int n,int r, int deger)
{
if(r== 0)
{
if (n-r != 0)
{
if(deger == 1)
{
printf("(a^%ld) +",n-r);
}
else
{
{
printf(" %ld*(a^%ld) +",deger,n-r);
}
}
else
{
printf("1");
}
}
else if(r>0 && r<n)
{
printf(" %ld*(a^%ld*b^%ld) +",deger,n-r,r);
}
else
{
if(deger==1)
{
printf(" (b^%ld)",r);
}
else
{
printf(" %ld*(b^%ld)",deger,r);
}
}
}
void calculate(int n)
{
int r;
int deger;
for (r=0;r<=n;r++)
{
deger = Combination(n,r);
print(n,r,deger);
}
}
int Combination( int n, int k)
{
if(k == 0)
{
return 1;
}
if(k>n-k)
{
return Combination(n,n-k);
}
void Polynomial()
{
int a[100];
int i, n, power;
float x, polySum;
printf("nEnter the order of the polynomial : ");
scanf("%d", &n);
printf("Enter the value of x : ");
scanf("%f", &x);
printf("Enter %d coefficients : ", n+1);
for (i=0; i<=n; i++)
{
scanf("%d", &a[i]);
}
polySum = a[0];
for (i=1; i<=n; i++)
{
polySum = polySum*x + a[i];
}
power = n;
printf("Given polynomial is: ");
for (i=0; i<=n; i++)
{
if (power<0)
{
break;
}
if (a[i]>0)
printf(" + ");
else
printf(" ");
printf("%dx^%d ", a[i], power--);
}
printf("nSum of the polynomial = %fn", polySum);
}
void Decimal()
{
int a[10], number, i=1, j;
printf("nPlease Enter the Decimal Number You want to Convert: ");
scanf("%d", &number);
printf("Octal Number of a Given Number = %o",number);
printf("nHexadecimal Number of a Given Number = %x",number);
while(number != 0)
{
a[i++] = number % 2;
number = number / 2;
}
printf("nBinary Number of a Given Number = ");
for(j = i - 1; j > 0; j--)
{
printf("%d", a[j]);
}
return 0;
}
void Hexadecimal()
{
int number;
printf("Please Enter the Hexadecimal Number You want to Convert: ");
scanf("%x",&number);
printf("nDecimal Number of a Given Number = %d",number);
printf("nOctal Number of a Given Number = %o",number);
}
void Octal()
{
int number;
printf("Please Enter the Octal Number You want to Convert: ");
scanf("%o",&number);
printf("Decimal Number of a Given Number = %d",number);
printf("nHexadecimal Number of a Given Number = %x",number);
}
Code Explanation
 Here we use,
 Array: An array is defined as the collection of similar type of data items stored at
contiguous memory location. In this code we use array for Log in.
 Switch Case: A switch statement allows a variable to be tested for equality against
a list of values. Each callus called a case,and the variable being switched on is
checked for each switch case.Here we used switch case for Code Input.
 Loop: Used to iterate the statements or a part of the program several times. To
make this code use use For Loop & While Loop.
 Stack: Like as array.
 String: A string is a characters terminated with a null character.0
 Some build in function like- (sin) (cos) (tan).
 Octal which we define as %o, Hexa-Decimal-%x,
 Decimal-%d.
APPLICATIONS
In most countries, students use calculators for schoolwork. There was
some initial resistance to the idea out of fear that basic arithmetic skills
would suffer. There remains disagreement about the importance of
the ability to perform calculations "in the head", with some curricula
restricting calculator use until a certain level of proficiency has been
obtained, while others concentrate more on teaching estimation
techniques and problem-solving. Research suggests that inadequate
guidance in the use of calculating tools can restrict the kind of
mathematical thinking that students engage in. Others have argued
that calculator use can even cause core mathematical skills to atrophy,
or that such use can prevent understanding of advanced algebraic
concepts.
Future Scope of the Project
Our project will be able to implement in future after making some
changes and modifications as we make our project at a very low level.
So the modifications that can be done in our project are:
To make it screen touch so no need to touch key buttons and one more
change which can we made is to add snaps of the person who use it.
Testing
Testing is the major control measure used during software development.
Its basic function is to detect errors in the software. During requirement
analysis and design, the output is a document that is usually textual and no
executable. After the coding phase, computer programs are available that
can be executed for testing purpose. This implies that testing not only, has
to uncover errors introduced during coding, but also errors introduced
during previous phase. Thus the goal of testing is to uncover the
requirements, design and coding errors in the programs. TheSourcecode
declared above for the program of Scientific Calculator has been tested
and it has been found that the above source code is okay and correct.The
program involves many type of conversions. These conversions has to
done carefully.
That’s It
Thank You

CSE 103 Project Presentation.pptx

  • 1.
  • 2.
    Topic : ScientificCalculator Presented To: Dr. Md Azam Hossain CSE 103 (Section:07)
  • 3.
    Our Team 1. MubassirRahman Rounak (2022-1-60-135) 2. Meghla Jahan Urme (2022-1-60-139) 3.Tasnim Saima Raita (2022-1-60-291)
  • 4.
    TABLE OF CONTENTS 1.Introduction 2.Basicfunction 3.System Design 4.Source code 5.Code explanation 6.Testing 7.Future scope of project
  • 5.
    INTRODUCTION Scientific Calculator : Thecalculator 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.
  • 6.
    Basic Functions  Addition Theaddition (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.
  • 7.
     Square The squarefunction 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 "^".  Factorial The Factorial function is used by clicking the "!" button or type "!".  Modulus This function is used by click % button.  Trigonometry This function is used by clicking sin, cos, tan, sec, cosec button. It represents the trigonometric operations.
  • 8.
     Pi PI isa mathematical constant of the ratio of a circle's circumference to its diameter.  Numeric conversion This function is used for converting a number into binary, decimal, hexadecimal, octal.  Expression  Permutation combination
  • 9.
    System Design Then webegan with the design phase of the system. System design is a solution, a “HOW TO” approach to the creation of a new system. It translates system requirements into ways by which they can be made operational. It is a translational from a user oriented document to a document oriented programmers. For that, it provides the understanding and procedural details necessary for the implementation. Here we use flowchart to supplement the working of the new system. The system thus made should be reliable, durable and above all should have least possible maintenance costs. It should overcome all the drawbacks of the old existing system and most important of all meet the user requirements.
  • 10.
    Coding #include<stdio.h> #include<stdlib.h> #include<conio.h> #include<math.h> #define note "Enterthe valid operation" void addition(); void subtraction(); void multiplication(); void division(); void modulus(); void expressions(); void factorial_(); void power(); void squareroot(); void trigonometry(); void Permutation_Combination();
  • 11.
    long factorial(int); long permutation(int,int); longcombination(int,int); void Binomial(); void Polynomial(); void Decimal(); void Hexadecimal(); void Octal(); int main() { int i,c=0; char ch1[20],ch2[20],ch; system("COLOR 0A"); printf("=================================================================================== =====================================n"); printf(" LOG IN SYSTEM n"); printf("=================================================================================== =====================================n"); printf("n"); printf("Enter Your Username : n"); gets(ch1); printf("Enter Your Password : n");
  • 12.
  • 13.
    ch2[c]=ch; c++; } ch2[c]='0'; } printf("n"); if(strcmp(ch1,"user")==0) { if(strcmp(ch2,"1234")==0) { printf("Log in Successful"); printf("npressEnter for new screen"); getch(); system("cls"); system("COLOR 5E"); printf("========================================================================================== "); printf("n Welcome to the scientific calculator!! n"); printf("========================================================================================== "); int choice;
  • 14.
    printf("nnn****** Press 0to quite the program ******nn"); printf("Enter 1 for additionn"); printf("Enter 2 for subtractionn"); printf("Enter 3 for multiplicationn"); printf("Enter 4 for divisionn"); printf("Enter 5 for modulusn"); printf("Enter 6 for expressionsn"); printf("Enter 7 for factorialn"); printf("Enter 8 for powern"); printf("Enter 9 for squarerootn"); printf("Enter 10 for trigonometryn"); printf("Enter 11 for permutation & combinationn"); printf("Enter 12 for Binomial equationn"); printf("Enter 13 for Polynomial equationn"); printf("Enter 14 for Decimal number to all base numbern") printf("Enter 15 for Hexadecimal number to all base numbern"); printf("Enter 16 for Octal number to all base numbern"); while(1) { printf("nnEnter the operation you want to do: ");
  • 15.
    scanf("%d",&choice); switch(choice) { case 1: addition(); break; case 2: subtraction(); break; case3: multiplication(); break; case 4: division(); break; case 5: modulus(); break; case 6: expressions(); break; case 7: factorial_(); break; case 8:
  • 16.
    power(); break; case 9: squareroot(); break; case 10: trigonometry(); break; case11: Permutation_Combination(); break; case 12: Binomial(); break; case 13: Polynomial(); break; case 14: Decimal(); break; case 15:
  • 17.
    Hexadecimal(); break; case 16: Octal(); break; case 0: exit(0); default: printf("n**********%s **********n",note); } } } else printf("Password was Wrong !!"); } else printf("Username was Wrong !!"); getch(); } void addition() { int m,i,A[100],sum=0; printf("Enter the size of array : "); scanf("%d",&m); printf("Enter the elements of array : "); for(i=0; i<m; i++)
  • 18.
    { scanf("%d",&A[i]); } printf("Sum of theelements : "); for(i=0; i<m; i++) { sum=sum+A[i]; } printf("%d",sum); } void subtraction() { int a, b; printf("Enter the numbers you want to subtract : "); scanf("%d%d",&a,&b); printf("The subtraction of a and b is %d",a-b); } void multiplication() int m, i, A[100], mul=1; printf("Enter the size of array : "); scanf("%d",&m);
  • 19.
    printf("Enter the elementsof array : "); for(i=0; i<m; i++) { scanf("%d",&A[i]); } printf("Multiplication of the elements : "); for(i=0; i<m; i++) { mul=mul*A[i]; } printf("%d",mul); } void division() { int a, b; printf("Enter the numbers you want to devide : "); scanf("%d%d",&a,&b); printf("The division of a and b is %f",(float)a/(float)b); } void modulus()
  • 20.
    int precedence(char a,charb) { if(((a=='+')||(a=='-'))&&((b=='*')||(b=='/'))) return 0; else return 1; } char expr[20]; char stack[20]; int i; int ctr; int top=-1; int topOper=-1; int operate(int a,int b,char oper) { int res=0; switch(oper) { case '+':res=a+b;break; case '-':res=a-b;break; case '*':res=a*b;break; case '/':res=a/b;break;
  • 21.
    } return res; } void postfixConvert() { chartopsymb,operatorStack[20]; ctr=0; while(expr[ctr]!='0') { if(expr[ctr]>='0'&&expr[ctr]<='9') stack[++top]=expr[ctr]; else { while(topOper>=0&&precedence(operatorStack[topOper],expr[ctr])) { topsymb=operatorStack[topOper--]; stack[++top]=topsymb; } operatorStack[++topOper]=expr[ctr] }
  • 22.
    ctr++; } while(topOper>=0) stack[++top]=operatorStack[topOper--]; } void expressions() { printf("Enter theExpressionn"); scanf("%s",&expr); postfixConvert(); char oper; int operand1,operand2; ctr=0; int result[2]; int rTop=-1; while(stack[ctr]!='0') { oper=stack[ctr]; if(oper>='0'&&oper<='9') result[++rTop]=(int)(oper-'0'); else {
  • 23.
    operand1=result[rTop--]; operand2=result[rTop--]; result[++rTop]=operate(operand2,operand1,oper); } ctr++; } printf("The result ofthe expression isn%dn",result[0]); getch(); } void factorial_() { int n, i, fact; printf("Enter the number you want the factorial of : "); scanf("%d",&n); fact=1; for(i=1; i<=n; i++) { fact=fact*i; } printf("Factorial of %d is %d",n,fact); } void power() { double x, n, p; printf("Enter the base number: ");
  • 24.
    scanf("%lf", &x); printf("Enter thepower: "); scanf("%lf",&n); p = pow(x,n); printf("%.1lf^%.1lf = %.2lf", x, n, p); return 0; } void squareroot() { double number, squareroot; printf("Enter a number: "); scanf("%lf", &number); squareroot = sqrt(number); printf("Square root of %.2lf = %.2lf", number, squareroot); return 0; } void trigonometry() { float n, p; printf("Enter angle in degree: ");
  • 25.
    scanf("%f",&n); p = n* (3.1416/180); printf("Sin(%.2f) = %.2f",n,sin(p)); printf("nCos(%.2f) = %.2f",n,cos(p)); printf("nTan(%.2f) = %.2f",n,tan(p)); printf("nCot(%.2f) = %.2f",n,1/tan(p)); printf("nSec(%.2f) = %.2f",n,1/cos(p)); printf("nCosec(%.2f) = %.2f",n,1/sin(p)); return 0; } void Permutation_Combination() { int n, r; long npr, ncr; printf("Enter the value of n and r : "); scanf("%d%d", &n, &r); npr = permutation(n, r); ncr = combination(n, r); printf("n%dP%d = %ld", n, r, npr); printf("n%dC%d = %ld", n, r, ncr); return 0;
  • 26.
    } long permutation(int a,int b) { return (factorial(a)/(factorial(a-b))); } long combination(int a, int b) { return (factorial(a)/(factorial(b)*(factorial(a-b)))); } long factorial(int c) { if(c == 1|| c==0) return 1; else return c*factorial(c-1); } void Binomial() { int s=0; printf("Enter the binomial order : "); scanf("%ld", &s); while (s < 0)
  • 27.
    { printf("Please enter positivebinomial order : "); scanf("%d", &s); } printf("(a+b)^%ld =",s); printf("n"); for(int k = 0; s >= k; k++) { calculate(k); printf("n"); } return 0; } void print(int n,int r, int deger) { if(r== 0) { if (n-r != 0) { if(deger == 1) { printf("(a^%ld) +",n-r); } else {
  • 28.
    { printf(" %ld*(a^%ld) +",deger,n-r); } } else { printf("1"); } } elseif(r>0 && r<n) { printf(" %ld*(a^%ld*b^%ld) +",deger,n-r,r); } else { if(deger==1) { printf(" (b^%ld)",r); } else { printf(" %ld*(b^%ld)",deger,r); }
  • 29.
    } } void calculate(int n) { intr; int deger; for (r=0;r<=n;r++) { deger = Combination(n,r); print(n,r,deger); } } int Combination( int n, int k) { if(k == 0) { return 1; } if(k>n-k) { return Combination(n,n-k); }
  • 30.
    void Polynomial() { int a[100]; inti, n, power; float x, polySum; printf("nEnter the order of the polynomial : "); scanf("%d", &n); printf("Enter the value of x : "); scanf("%f", &x); printf("Enter %d coefficients : ", n+1); for (i=0; i<=n; i++) { scanf("%d", &a[i]); } polySum = a[0]; for (i=1; i<=n; i++) { polySum = polySum*x + a[i]; } power = n;
  • 31.
    printf("Given polynomial is:"); for (i=0; i<=n; i++) { if (power<0) { break; } if (a[i]>0) printf(" + "); else printf(" "); printf("%dx^%d ", a[i], power--); } printf("nSum of the polynomial = %fn", polySum); } void Decimal() { int a[10], number, i=1, j; printf("nPlease Enter the Decimal Number You want to Convert: "); scanf("%d", &number); printf("Octal Number of a Given Number = %o",number); printf("nHexadecimal Number of a Given Number = %x",number);
  • 32.
    while(number != 0) { a[i++]= number % 2; number = number / 2; } printf("nBinary Number of a Given Number = "); for(j = i - 1; j > 0; j--) { printf("%d", a[j]); } return 0; } void Hexadecimal() { int number; printf("Please Enter the Hexadecimal Number You want to Convert: "); scanf("%x",&number); printf("nDecimal Number of a Given Number = %d",number); printf("nOctal Number of a Given Number = %o",number);
  • 33.
    } void Octal() { int number; printf("PleaseEnter the Octal Number You want to Convert: "); scanf("%o",&number); printf("Decimal Number of a Given Number = %d",number); printf("nHexadecimal Number of a Given Number = %x",number); }
  • 34.
    Code Explanation  Herewe use,  Array: An array is defined as the collection of similar type of data items stored at contiguous memory location. In this code we use array for Log in.  Switch Case: A switch statement allows a variable to be tested for equality against a list of values. Each callus called a case,and the variable being switched on is checked for each switch case.Here we used switch case for Code Input.  Loop: Used to iterate the statements or a part of the program several times. To make this code use use For Loop & While Loop.  Stack: Like as array.  String: A string is a characters terminated with a null character.0  Some build in function like- (sin) (cos) (tan).  Octal which we define as %o, Hexa-Decimal-%x,  Decimal-%d.
  • 35.
    APPLICATIONS In most countries,students use calculators for schoolwork. There was some initial resistance to the idea out of fear that basic arithmetic skills would suffer. There remains disagreement about the importance of the ability to perform calculations "in the head", with some curricula restricting calculator use until a certain level of proficiency has been obtained, while others concentrate more on teaching estimation techniques and problem-solving. Research suggests that inadequate guidance in the use of calculating tools can restrict the kind of mathematical thinking that students engage in. Others have argued that calculator use can even cause core mathematical skills to atrophy, or that such use can prevent understanding of advanced algebraic concepts.
  • 36.
    Future Scope ofthe Project Our project will be able to implement in future after making some changes and modifications as we make our project at a very low level. So the modifications that can be done in our project are: To make it screen touch so no need to touch key buttons and one more change which can we made is to add snaps of the person who use it.
  • 37.
    Testing Testing is themajor control measure used during software development. Its basic function is to detect errors in the software. During requirement analysis and design, the output is a document that is usually textual and no executable. After the coding phase, computer programs are available that can be executed for testing purpose. This implies that testing not only, has to uncover errors introduced during coding, but also errors introduced during previous phase. Thus the goal of testing is to uncover the requirements, design and coding errors in the programs. TheSourcecode declared above for the program of Scientific Calculator has been tested and it has been found that the above source code is okay and correct.The program involves many type of conversions. These conversions has to done carefully.
  • 38.