Tuesday 29 January 2013

Scientific Calculator in C Language







Now make your own scientific calculator in C programming:..................

Just copy the source code in a note pad file
and save it in .c extension.....

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<math.h>
void co();
void algebric();
void trigonometrical();
void exponential();
void logarithm();
void addition();
void subtraction();
void multiplication();
void dividation();
void power();
void root();
void factorial();
void sina();
void cosa();
void tana();
void isin();
void icos();
void itan();
void sinha();
void cosha();
void tanha();
void natural1();
void b10();
void exponential();
void pexp();
void per();
void com();
int fact(int a);
void help();
void conv();
void d2r();
void r2d();
void main()
{

int gd=DETECT,gm;
char ch;
initgraph(&gd,&gm,"c:\\tc\\bgi");

cleardevice();
setbkcolor(17);
setcolor(9);
settextstyle(1,0,4);
rectangle(6,10,630,450)
;
outtextxy(55,30,"Poornima College Of Engineering");

settextstyle(8,0,4);
setcolor(1);
outtextxy(100,100,"SCIENTIFIC CALCULATOR");

settextstyle(1,0,3);
outtextxy(30,240,"Guided By:");
outtextxy(380,240,"Programmed By:");
setcolor(12);
settextstyle(1,0,1);
outtextxy(30,290,"Mr.SANJAY GUPTA");
outtextxy(30,320,"(Lecturer,IT)");
outtextxy(380,290,"Devendra Bhavsar");
outtextxy(380,320,"Kirti Khandelwal");
outtextxy(380,350,"E-2 (CE)");
getch();
co();
getch();
}

void co()
{
int a,b,c;
int gd=DETECT,gm;
char ch,n;
initgraph(&gd,&gm,"c:\\tc\\bgi");

while(1)
{

cleardevice();
a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(3);
settextstyle(7,0,3);
outtextxy(10,9," Scientific Calculator");

settextstyle(8,0,2);
setcolor(8);
bar3d(a-150,5,a-130,38,1,1);
bar3d(a-120,5,a-15,38,1,1);
setcolor(16);
outtextxy(a-145,8,"_");
outtextxy(a-115,8,"Alt+tab");


settextstyle(8,0,3);
setcolor(7);
bar3d(25,70,400,100,4,1);
outtextxy(30,70,"Home");

bar3d(25,120,50,150,4,1);
outtextxy(32,119,"1");

bar3d(65,120,300,150,4,1);
outtextxy(70,119,"Algebric");

bar3d(25,170,50,200,4,1);
outtextxy(30,169,"2");

bar3d(65,170,300,200,4,1);
outtextxy(70,169,"Trignometric");

bar3d(25,220,50,250,4,1);
outtextxy(30,219,"3");

bar3d(65,220,300,250,4,1);
outtextxy(70,219,"Logarithmic");

bar3d(25,270,50,300,4,1);
outtextxy(30,269,"4");

bar3d(65,270,300,300,4,1);
outtextxy(70,269,"Exponential");

bar3d(25,320,50,350,4,1);
outtextxy(30,319,"5");

bar3d(65,320,300,350,4,1);
outtextxy(70,319,"Conversion");




bar3d(a-240,b-80,a-215,b-50,4,1);
outtextxy(a-235,b-82,"h");

bar3d(a-200,b-80,a-50,b-50,4,1);
outtextxy(a-195,b-82,"Help");

bar3d(a-240,b-40,a-215,b-10,4,1);
outtextxy(a-235,b-42,"e");

bar3d(a-200,b-40,a-50,b-10,4,1);
outtextxy(a-195,b-42,"Exit");

setcolor(10);
settextstyle(2,0,5);
outtextxy(10,b-15,"Poornima College Of Engineering");

n=getch();


switch(n)
{
case '1':
algebric();
break;
case '2':
trigonometrical();
break;
case '3':
logarithm();
break;
case '4':
exponential();
break;

case '5':
conv();
break;

case 'h':  help();
break;
case 'H':  help();
break;

case 'e':
exit(1);
break;
case 'E':
exit(1);
break;
default:
getch();
algebric();
}

}
}
void algebric()
{

char x;
int a,b,c;

cleardevice();


a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Algebric");


setcolor(7);
bar3d(25,70,400,100,4,1);
outtextxy(30,70,"Choose Operation");

bar3d(25,120,50,150,4,1);
outtextxy(32,119,"1");

bar3d(65,120,300,150,4,1);
outtextxy(70,119,"Addition");

bar3d(25,170,50,200,4,1);
outtextxy(30,169,"2");

bar3d(65,170,300,200,4,1);
outtextxy(70,169,"Substraction");

bar3d(25,220,50,250,4,1);
outtextxy(30,219,"3");

bar3d(65,220,300,250,4,1);
outtextxy(70,219,"Multiplication");

bar3d(25,270,50,300,4,1);
outtextxy(30,269,"4");

bar3d(65,270,300,300,4,1);
outtextxy(70,269,"Division");

bar3d(25,320,50,350,4,1);
outtextxy(30,319,"5");

bar3d(65,320,300,350,4,1);
outtextxy(70,319,"Factorial");

bar3d(25,370,50,400,4,1);
outtextxy(30,369,"6");

bar3d(65,370,300,400,4,1);
outtextxy(70,369,"Permutation [nPr]");

bar3d(25,420,50,450,4,1);
outtextxy(30,419,"7");

bar3d(65,420,300,450,4,1);
outtextxy(70,419,"Combination [nCr]");



bar3d(a-240,b-80,a-215,b-50,4,1);
outtextxy(a-235,b-82,"h");

bar3d(a-200,b-80,a-50,b-50,4,1);
outtextxy(a-195,b-82,"Home");

bar3d(a-240,b-40,a-215,b-10,4,1);
outtextxy(a-235,b-42,"e");

bar3d(a-200,b-40,a-50,b-10,4,1);
outtextxy(a-195,b-42,"Exit");


x=getch();
switch(x)
{
case '1':  addition();
break;

case '2':  subtraction();
break;

case '3':  multiplication();
break;

case '4':  dividation();
break;

case '5':  factorial();
break;

case '6': per();
break;

case '7': com();
break;

case 'h':  co();
break;
case 'H':  co();
break;

case 'e':  exit(1);
 break;

case 'E':  exit(1);
 break;


default:
getch();
algebric();
break;

}
getch();
}

void addition()
{
float ad[16],sum=0;
int i,a,b,n;
cleardevice();

a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Algebric > Addition");

setcolor(7);
settextstyle(8,0,2);
bar3d(25,70,500,100,4,1);
outtextxy(30,70,"How many numbers (max-16)");

bar3d(520,70,600,100,4,1);

gotoxy(68,6);
scanf("%d",&n);
if(n>16)
{
gotoxy(20,10);
printf("Only 16 numbers can be added");
}
else
{
gotoxy(25,7);
printf("\n");
for(i=0;i<n;i++)
{
printf("\t\t\t(%d)-\t ",i+1);
scanf("%f",&ad[i]);
}

for(i=0;i<n;i++)
{
sum=sum+ad[i];
}
bar3d(a-200,b-50,a-70,b-80,4,1);
gotoxy(57,26);
printf("%f",sum);
}
getch();


}
void subtraction()
{
int i,n,a,b;
float sb[10],sub;
cleardevice();
a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Algebric > Substraction");


setcolor(7);
settextstyle(8,0,2);
bar3d(25,70,500,100,4,1);
outtextxy(30,70,"How many numbers (max-16)");

bar3d(520,70,600,100,4,1);
gotoxy(68,6);
scanf("%d",&n);
if(n>16)
{
gotoxy(20,10);
printf("Only 16 numbers can be subtracted");
}
else
{
gotoxy(25,7);
printf("\n");
for(i=0;i<n;i++)
{
printf("\t\t\t(%d)-\t ",i+1);
scanf("%f",&sb[i]);
}
sub=sb[0];
for(i=1;i<n;i++)
{
sub=sub-sb[i];
}
bar3d(a-200,b-50,a-70,b-80,4,1);
gotoxy(57,26);
printf("%f",sub);
}

getch();

}
void multiplication()
{     int i,n,a,b;
float mt[16],mult=1;
cleardevice();
a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Algebric > Multiplication");


setcolor(7);
settextstyle(8,0,2);
bar3d(25,70,500,100,4,1);
outtextxy(30,70,"How many numbers (max-16)");

bar3d(520,70,600,100,4,1);
gotoxy(68,6);
scanf("%d",&n);
if(n>16)
{
gotoxy(20,10);
printf("Only 16 numbers can be multiplied");
}
else
{
gotoxy(25,7);
printf("\n");
for(i=0;i<n;i++)
{
printf("\t\t\t(%d)-\t ",i+1);
scanf("%f",&mt[i]);
}
for(i=0;i<n;i++)
{
mult=mult*mt[i];
}
bar3d(a-200,b-50,a-70,b-80,4,1);
gotoxy(57,26);
printf("%f",mult);
}
getch();
}

void dividation()
{
float f,g,div;
int a,b;
cleardevice();
a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Algebric > Division");


setcolor(7);
bar3d(25,70,500,100,4,1);
outtextxy(30,70,"Enter the divisor ");
bar3d(520,70,600,100,4,1);
gotoxy(68,6);
scanf("%f",&f);

bar3d(25,120,500,150,4,1);
outtextxy(30,120,"Enter the dividend ");
bar3d(520,120,600,150,4,1);
gotoxy(68,9);
scanf("%f",&g);
bar3d(a-200,b-50,a-30,b-80,4,1);
gotoxy(57,26);
if(g==0)
{
printf("Not Defined");
}
else
{
div=f/g;
printf("%f",div);
       }
}

void factorial()
{
int a,b,i,n;
float fct;
cleardevice();
a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Algebric > Factorial");


setcolor(7);
bar3d(25,70,500,100,4,1);
outtextxy(30,70,"Enter number");

bar3d(520,70,600,100,4,1);
gotoxy(68,6);
scanf("%d",&n);
fct=1;
for(i=n;i>=1;i--)
{
fct=fct*i;
}
bar3d(a-200,b-50,a-30,b-80,4,1);
gotoxy(57,26);
printf("%f",fct);
fct=1;
getch();
}
void trigonometrical()

{
int a,b;
char n;
cleardevice();


a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Trignometric");






setcolor(7);
bar3d(25,70,400,100,4,1);
outtextxy(30,70,"Choose Operation");

bar3d(25,120,50,150,4,1);
outtextxy(27,119,"1");

bar3d(65,120,200,150,4,1);
outtextxy(70,119,"sin( )");

bar3d(275,120,300,150,4,1);
outtextxy(277,119,"7");

bar3d(315,120,450,150,4,1);
outtextxy(321,119,"sin-1( )");


bar3d(25,170,50,200,4,1);
outtextxy(27,169,"2");

bar3d(65,170,200,200,4,1);
outtextxy(70,169,"cos( )");

bar3d(275,170,300,200,4,1);
outtextxy(277,169,"8");

bar3d(315,170,450,200,4,1);
outtextxy(320,169,"cos-1( )");


bar3d(25,220,50,250,4,1);
outtextxy(27,219,"3");

bar3d(65,220,200,250,4,1);
outtextxy(70,219,"tan( )");


bar3d(315,220,450,250,4,1);
outtextxy(320,219,"tan-1( )");


bar3d(25,270,50,300,4,1);
outtextxy(27,269,"4");

bar3d(65,270,200,300,4,1);
outtextxy(67,269,"sinh( )");

bar3d(25,320,50,350,4,1);
outtextxy(27,319,"5");

bar3d(65,320,200,350,4,1);
outtextxy(67,319,"cosh( )");

bar3d(25,370,50,400,4,1);
outtextxy(27,369,"6");

bar3d(65,370,200,400,4,1);
outtextxy(67,369,"tanh( )");


bar3d(a-240,b-80,a-215,b-50,4,1);
outtextxy(a-235,b-82,"h");

bar3d(a-200,b-80,a-50,b-50,4,1);
outtextxy(a-195,b-82,"Home");

bar3d(a-240,b-40,a-215,b-10,4,1);
outtextxy(a-235,b-42,"e");

bar3d(a-200,b-40,a-50,b-10,4,1);
outtextxy(a-195,b-42,"Exit");

n=getch();
switch(n)
{
case '1':
sina();
break;
case '2':
cosa();
break;

case '3':
tana();
break;

case '4':
sinha();
break;

case '5':
 cosha();
 break;
case '6':
tanha();
break;

case '7':
isin();
break;

case '8':
icos();
break;

case '9':
itan();
break;


case 'h':
co();
break;
case 'H':
co();
break;
case 'e':
exit(1);
break;
case 'E':
exit(1);
break;
       default:
       getch();
       trigonometrical();
       break;
}
 getch();
}
void sina()
{
int a,b;
double result;
double x,k;
cleardevice();

a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Trignometric > sin( )");


setcolor(7);
bar3d(25,70,500,100,4,1);
outtextxy(30,70,"Enter the value of x");

bar3d(520,70,600,100,4,1);
gotoxy(68,6);
scanf("%lf",&x);
k=x*(3.141592654)/180;
result = sin(k);
bar3d(a-200,b-50,a-30,b-80,4,1);
gotoxy(57,26);
printf("%lf",  result);
}
void cosa()
{
int a,b;
double result;
double x,k;
cleardevice();

a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Trignometric > cos( )");


setcolor(7);
bar3d(25,70,500,100,4,1);
outtextxy(30,70,"Enter the value of x");

bar3d(520,70,600,100,4,1);
gotoxy(68,6);
scanf("%lf",&x);
k=x*(3.141592654)/180;
result =cos(k);
bar3d(a-200,b-50,a-30,b-80,4,1);
gotoxy(57,26);
printf("%lf",  result);
}
void tana()
{
int a,b,y;
double result;
double x,k;
cleardevice();

a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Trignometric > tan( )");


setcolor(7);
bar3d(25,70,500,100,4,1);
outtextxy(30,70,"Enter the value of x");

bar3d(520,70,600,100,4,1);
gotoxy(68,6);
scanf("%lf",&x);
y=x/90;
bar3d(a-200,b-50,a-30,b-80,4,1);
gotoxy(57,26);
if(y%2!=0)
{
printf("Not Defined");
}
else
{
k=x*(3.141592654)/180;
result = tan(k);
printf("%lf",  result);
}
}
void sinha()
{
int a,b;
double result;
double x,k;
cleardevice();

a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Trignometric > sinh( )");


setcolor(7);
bar3d(25,70,500,100,4,1);
outtextxy(30,70,"Enter the value of x");

bar3d(520,70,600,100,4,1);
gotoxy(68,6);
scanf("%lf",&x);
k=x;
result = sinh(k);
bar3d(a-200,b-50,a-30,b-80,4,1);
gotoxy(57,26);
printf("%lf",  result);
}
void cosha()
{

int a,b;
double result;
double x,k;
cleardevice();

a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Trignometric > cosh( )");


setcolor(7);
bar3d(25,70,500,100,4,1);
outtextxy(30,70,"Enter the value of x");

bar3d(520,70,600,100,4,1);
gotoxy(68,6);
scanf("%lf",&x);
k=x;
result = cosh(k);
bar3d(a-200,b-50,a-30,b-80,4,1);
gotoxy(57,26);
printf("%lf",  result);
}
void tanha()
{
int a,b;
double result;
double x,k;
cleardevice();

a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Trignometric > tanh( )");


setcolor(7);
bar3d(25,70,500,100,4,1);
outtextxy(30,70,"Enter the value of x");

bar3d(520,70,600,100,4,1);
gotoxy(68,6);
scanf("%lf",&x);
k=x;
result = tanh(k);
bar3d(a-200,b-50,a-30,b-80,4,1);
gotoxy(57,26);
printf("%lf",result);
}
void isin()
{

int a,b;
double result;
double x,k;
cleardevice();

a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Trignometric > sin-1( )");


setcolor(7);
bar3d(25,70,500,100,4,1);
outtextxy(30,70,"Enter the value of x");

bar3d(520,70,600,100,4,1);
gotoxy(68,6);
scanf("%lf",&x);

bar3d(a-200,b-50,a-30,b-80,4,1);
gotoxy(57,26);
if(x>=-1&&x<=1)
{
k=x;
result = (180*asin(k))/3.141592654;
printf("%lf",result);
}
else
{
printf("Not Defined");
}
getch();
}
void icos()
{

int a,b;
double result;
double x,k;
cleardevice();

a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Trignometric > cos-1( )");


setcolor(7);
bar3d(25,70,500,100,4,1);
outtextxy(30,70,"Enter the value of x");

bar3d(520,70,600,100,4,1);
gotoxy(68,6);
scanf("%lf",&x);
bar3d(a-200,b-50,a-30,b-80,4,1);
gotoxy(57,26);
if(x>= -1&&x<= 1)
{
k=x;
result = (180*acos(k))/3.141592654;
printf("%lf",result);
}
else
{
printf("Not Defined");
}
getch();
}

void itan()
{

int a,b;
double result;
double x,k;
cleardevice();

a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Trignometric > tan-1( )");


setcolor(7);
bar3d(25,70,500,100,4,1);
outtextxy(30,70,"Enter the value of x");

bar3d(520,70,600,100,4,1);
gotoxy(68,6);
scanf("%lf",&x);
bar3d(a-200,b-50,a-30,b-80,4,1);
gotoxy(57,26);
k=x;
result = (180*atan(k))/3.141592654;
printf("%lf",result);
getch();

}
void logarithm()
{
char n;
int a,b;

cleardevice();


a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Logarithmic");

setcolor(7);
bar3d(25,70,400,100,4,1);
outtextxy(30,70,"Choose Operation");

bar3d(25,120,50,150,4,1);
outtextxy(32,119,"1");

bar3d(65,120,370,150,4,1);
outtextxy(70,119,"Natural Log(base-'e')");

bar3d(25,170,50,200,4,1);
outtextxy(30,169,"2");

bar3d(65,170,370,200,4,1);
outtextxy(70,169,"Common Log(base-'10')");



bar3d(a-240,b-80,a-215,b-50,4,1);
outtextxy(a-235,b-82,"h");

bar3d(a-200,b-80,a-50,b-50,4,1);
outtextxy(a-195,b-82,"Home");

bar3d(a-240,b-40,a-215,b-10,4,1);
outtextxy(a-235,b-42,"e");

bar3d(a-200,b-40,a-50,b-10,4,1);
outtextxy(a-195,b-42,"Exit");


n=getch();
switch(n)
{
case '1':
natural1();
break;

case '2':
b10();
break;

case 'h':
co();
break;
case 'e':
 exit(1);
 break;
case 'H':
co();
break;
case 'E':
 exit(1);
 break;
default:
getch();
logarithm();
break;
}
getch();
}
void natural1()
{
int a,b;
double result;
double x;
cleardevice();

a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Logarithmic > Natural logarithm");


setcolor(7);
bar3d(25,70,500,100,4,1);
outtextxy(30,70,"Enter the value of x");
bar3d(520,70,600,100,4,1);
gotoxy(68,6);
scanf("%lf",&x);
bar3d(a-200,b-50,a-30,b-80,4,1);
gotoxy(57,26);
if(x<=0)
{
printf("Not Defined");
}
else
{
result = log(x);
printf("%lf", result);
}
getch();
}
void b10()
{
int a,b;
double result;
double x;
cleardevice();

a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Logarithmic > Commom logarithm");


setcolor(7);
bar3d(25,70,500,100,4,1);
outtextxy(30,70,"Enter the value of x");
bar3d(520,70,600,100,4,1);
gotoxy(68,6);
scanf("%lf",&x);
bar3d(a-200,b-50,a-30,b-80,4,1);
gotoxy(57,26);
if(x<=0)
{
printf("Not Defined");
}
else
{
result = log10(x);
printf("%lf", result);
}
getch();
}


void exponential()
{
char n;
int a,b;
cleardevice();

a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Exponential");



setcolor(7);
bar3d(25,70,400,100,4,1);
outtextxy(30,70,"Choose Operation");

bar3d(25,120,50,150,4,1);
outtextxy(32,119,"1");

bar3d(65,120,300,150,4,1);
outtextxy(70,119,"'e' raised to x");

bar3d(25,170,50,200,4,1);
outtextxy(32,169,"2");

bar3d(65,170,300,200,4,1);
outtextxy(70,169,"Power");

bar3d(25,220,50,250,4,1);
outtextxy(32,219,"3");

bar3d(65,220,300,250,4,1);
outtextxy(70,219,"Square Root");





bar3d(a-240,b-80,a-215,b-50,4,1);
outtextxy(a-235,b-82,"h");

bar3d(a-200,b-80,a-50,b-50,4,1);
outtextxy(a-195,b-82,"Home");

bar3d(a-240,b-40,a-215,b-10,4,1);
outtextxy(a-235,b-42,"e");

bar3d(a-200,b-40,a-50,b-10,4,1);
outtextxy(a-195,b-42,"Exit");


n=getch();
switch(n)
{
case '1':
pexp();
break;
case '2':
power();
break;
case '3':
root();
break;

case 'h':
co();
break;
case 'e':
 exit(1);
 break;
case 'H':
co();
break;
case 'E':
 exit(1);
 break;

       default:
       exponential();
       break;
}
getch();
}
void pexp()
{
int a,b;
double result;
double x ;
cleardevice();

 a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Exponential > 'e'raised to x");


setcolor(7);
bar3d(25,70,500,100,4,1);
outtextxy(30,70,"Enter the value of x");
bar3d(520,70,600,100,4,1);
gotoxy(68,6);
scanf("%lf",&x);
result = exp(x);
bar3d(a-200,b-50,a-30,b-80,4,1);
gotoxy(57,26);
printf("%lf", result);
getch();
}
void power()
{
int x,a,b,c=1,i,y,z;
cleardevice();

a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Exponential > Power");

setcolor(7);
bar3d(25,70,500,100,4,1);
outtextxy(30,70,"Enter the base ");
bar3d(520,70,550,100,4,1);
gotoxy(68,6);
scanf("%d",&y);

bar3d(25,120,500,150,4,1);
outtextxy(30,120,"Enter the power ");
bar3d(520,120,550,150,4,1);
gotoxy(68,9);
scanf("%d",&z);
c=pow(y,z);
bar3d(a-200,b-50,a-30,b-80,4,1);
gotoxy(57,26);
printf("%d",c);
getch();
}

void root()
 {
    int a,b;
    float x,result;
    cleardevice();
a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Exponential > Square Root");


setcolor(7);
bar3d(25,70,500,100,4,1);
outtextxy(30,70,"Enter number");

bar3d(520,70,600,100,4,1);
gotoxy(68,6);
scanf("%f",&x);
bar3d(a-200,b-50,a-30,b-80,4,1);
gotoxy(57,26);
if(x<0)
{
printf("Not Defined");
}
else
{
result = sqrt(x);
printf("%f",result);
}
getch();
}
int fact(int x)
{
       int i,y=1;
       for(i=1;i<=x;i++)
{
y=y*i;
}
return y;
}
void per()
{
    int n,r,h,result;
    int a,b;
cleardevice();
a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Algebric > Permutation[nPr]");


setcolor(7);
bar3d(25,70,500,100,4,1);
outtextxy(30,70,"Enter the value of 'n'");
bar3d(520,70,600,100,4,1);
gotoxy(68,6);
scanf("%d",&n);

bar3d(25,120,500,150,4,1);
outtextxy(30,120,"Enter the value of 'r' ");
bar3d(520,120,600,150,4,1);
gotoxy(68,9);
scanf("%d",&r);
bar3d(a-200,b-50,a-30,b-80,4,1);
gotoxy(57,26);
if(r>n)
{
printf("Not Defined");
}
else
{
h=n-r;
result= (fact(n) / fact(h));
printf("%d",result);
}
getch();
}

void com()
{
     int n,r,h,result;
     int a,b;
cleardevice();
a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Algebric > Combination[nCr]");


setcolor(7);
bar3d(25,70,500,100,4,1);
outtextxy(30,70,"Enter the value of 'n'");
bar3d(520,70,600,100,4,1);
gotoxy(68,6);
scanf("%d",&n);

bar3d(25,120,500,150,4,1);
outtextxy(30,120,"Enter the value of 'r' ");
bar3d(520,120,600,150,4,1);
gotoxy(68,9);
scanf("%d",&r);

bar3d(a-200,b-50,a-30,b-80,4,1);
gotoxy(57,26);
if(r>n)
{
printf("Not Defined");
}
else
{
h=n-r;
result= (fact(n) / (fact(h) * fact(r)));
printf("%d",result);
}
getch();
}


void conv()
{
int a,b;
char n;
cleardevice();


a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Conversion");

setcolor(7);
bar3d(25,70,400,100,4,1);
outtextxy(30,70,"Choose Operation");

bar3d(25,120,50,150,4,1);
outtextxy(32,119,"1");

bar3d(65,120,370,150,4,1);
outtextxy(70,119,"Degree to Radian");

bar3d(25,170,50,200,4,1);
outtextxy(30,169,"2");

bar3d(65,170,370,200,4,1);
outtextxy(70,169,"Radian to Degree");

bar3d(a-240,b-80,a-215,b-50,4,1);
outtextxy(a-235,b-82,"h");

bar3d(a-200,b-80,a-50,b-50,4,1);
outtextxy(a-195,b-82,"Home");

bar3d(a-240,b-40,a-215,b-10,4,1);
outtextxy(a-235,b-42,"e");

bar3d(a-200,b-40,a-50,b-10,4,1);
outtextxy(a-195,b-42,"Exit");


n=getch();
switch(n)
{
case '1':
d2r();
break;

case '2':
r2d();
break;

case 'h':
co();
break;
case 'e':
 exit(1);
 break;
case 'H':
co();
break;
case 'E':
 exit(1);
 break;
default:
getch();
conv();
break;
}
getch();
}
void d2r()
{
int a,b;
double result;
double x;
cleardevice();

a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(8,0,3);
outtextxy(10,9," Conversion > Degree to Radian");


setcolor(7);
bar3d(25,70,500,100,4,1);
outtextxy(30,70,"Enter the value of angle(in degree)");

bar3d(520,70,600,100,4,1);
gotoxy(68,6);
scanf("%lf",&x);
bar3d(a-200,b-50,a-30,b-80,4,1);
result=(x*180)/3.141592654;
gotoxy(57,26);
printf("%lf", result);
getch();
}
void r2d()
{
int a,b;
double result;
double x;
cleardevice();

a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(5,5,a,b);

setcolor(7);
bar3d(5,5,a-5,40,4,1);

setcolor(7);
settextstyle(2,0,7);
outtextxy(10,9," Conversion > Radian to Degree");


setcolor(7);
bar3d(25,70,500,100,4,1);
outtextxy(30,70,"Enter the value of angle(in radian)");

bar3d(520,70,600,100,4,1);
gotoxy(68,6);
scanf("%lf",&x);

bar3d(a-200,b-50,a-30,b-80,4,1);
result=(x*3.141592654)/180;
gotoxy(57,26);
printf("%lf", result);
getch();
}

void help()
{

     int a,b;
     cleardevice();
a=getmaxx()-5;
b=getmaxy()-5;
setbkcolor(8);

setcolor(7);
rectangle(50,50,a-45,b-45);

setcolor(7);
bar3d(50,50,a-45,85,4,1);

setcolor(3);
settextstyle(8,0,3);
outtextxy(55,54," Help");


settextstyle(8,0,2);
setcolor(7);
outtextxy(60,100,"HOME");

settextstyle(2,0,6);
setcolor(7);
outtextxy(60,125,"The home is a starting point from which you");
outtextxy(60,140,"can select type of operation.");
outtextxy(60,155,"Enter the digits and characters as per your");
outtextxy(60,170,"choice,use numeric and alphabet keys on the");
outtextxy(60,185,"keyboard to navigate through the different ");
outtextxy(60,200,"menus.");
outtextxy(60,240,"> h/H - Home");
outtextxy(60,260,"> e/E - Exit");
outtextxy(60,280,"> 0-9 - Select Operation");
outtextxy(60,400,"Press Enter to go back...");
getch();


}

bar3d(275,220,300,250,4,1);
outtextxy(277,219,"9");





Loading...