This is a basic adding machine written in C dialect and works under DOS brief. The number cruncher performs all the essential arithematic operations including expansion, subtraction, trignometric figurings, and numerous different capacities. It can likewise ascertain logrithms, powers, and foundations of whole number numbers.

/*******************************************************

* MYCPLUS Sample Code - http://www.mycplus.com *

*

* This code is made accessible as a support of our *

* guests and is given entirely to the *

* motivation behind outline. *

*

* Please guide all request to saqib at mycplus.com *

*******************************************************/

#include

#include

#include

#include

void primary() {

clrscr();

scorch decision, choice2;

int addition=0, sum=0, subtraction=0, sub=0, multiplication=1, multi=1, division=1, dvs=1, square=0;

twofold logx, resultlog, sinx, resultsin, cosx, resultcos, tanx, resulttan, rootx, resultroot, expx, resultexp;

twofold truth, factorial, resultfact=1;

printf("WELCOME TO COMSATS INSTITUTE OF INforMATION TECHNOLOGY,ABBOTTABAD n");

printf("BIT-II nn");

printf("MADE BY: nn");

printf("AMBER SARDAR nn");

printf("MUNAZZA HAMEEDnn");

printf("Press enter to utilize the number cruncher");

getche();

clrscr();

printf("Enter decision n");

printf("Press n");

printf("[1] for Addition n");

printf("[2] for Subtraction n");

printf("[3] for Multiplication n");

printf("[4] for Division n");

printf("[5] for Scientific Functions n");

printf("[E] for Exit n");

choice=getch();

if((choice=='e')||(choice=='E'))

exit(0);

else if(choice=='1') {

clrscr();

printf("Add numbers or squeeze q to stop n");

do {

printf("Enter number ");

scanf("%d",&addition);

sum=addition+sum;}

while(getch()!='q');

printf("Result is %d",sum);

getche();

}

else if(choice=='2') {

clrscr();

printf("This system subtract given number from last given number or squeeze q to stop n");

printf("Enter number ");

scanf("%d",&subtraction);

sub=subtraction;

while(getch()!='q') {

printf("Enter number ");

scanf("%d",&subtraction);

sub=sub-subtraction;}

while(getch()!='q');

printf("Result is %d",sub);

getch();

}

else if(choice=='3') {

clrscr();

printf("Multiply numbers or squeeze q to stop ");

do {

printf("Enter number ");

scanf("%d",&multiplication);

multi=multiplication*multi; }

while(getch()!='q');

printf("Result is %d",multi);

getch();

}

else if(choice=='4') {

clrscr();

printf("This project separation given number from last given number or squeeze q to stop n");

printf("Enter number ");

scanf("%d",&division);

dvs=division;

while(getch()!='q') {

printf("Enter number ");

scanf("%d",&division);

dvs=subtraction/dvs;}

printf("Result is %d",dvs);

getch();

}

else if(choice=='5') {

clrscr();

printf(" Scientific Function n");

printf("Press n");

printf("[1] for x square n");

printf("[2] for foundation of x n");

printf("[3] for log x n");

printf("[4] for exp of x n");

printf("[5] for Factorial of x n");

printf("[6] for Sin x n");

printf("[7] for Cos x n");

printf("[8] for Tan x n");

printf("[E] for Exit n");

choice2=getch();

}

if((choice2=='e')||(choice2=='E'))

exit(0);

else if(choice2=='1') {

clrscr();

printf("This project compute square of x n");

printf("Enter number ");

scanf("%d",&square);

square=square*square;

printf("Result is %d",square);

getch();

}

else if(choice2=='2') {

clrscr();

printf("This system figure Square foundation of x n");

printf("Enter number ");

scanf("%lf",&rootx);

resultroot=sqrt(rootx);

printf("The square base of %lf is %lfn", rootx, resultroot);

getch();

}

else if(choice2=='3') {

clrscr();

printf("This system figure Natural log of x n");

printf("Enter number ");

scanf("%lf",&logx);

resultlog=log(logx);

printf("The regular log of %lf is %lfn", logx, resultlog);

getche();

}

else if(choice2=='4') {

clrscr();

printf("This project ascertain e ^ x n");

printf("Enter number ");

scanf("%lf",&expx);

resultexp = exp(expx);

printf("'e' raised to the force of %lf (e ^ %lf) = %lfn",

expx, expx, resultexp);

getche();

}

else if(choice2=='5') {

clrscr();

printf("This system figure Factorial x n");

printf("Enter number ");

scanf("%lf",&fact);

for(int factorial=fact;factorial>=1;factorial- - )

resultfact=resultfact*factorial;

printf("The factorial of %lf will be %lf ",fact,resultfact);

getch();

}

else if(choice2=='6') {

clrscr();

printf("This project ascertain Sin x n");

printf("Enter number ");

scanf("%lf",&sinx);

resultsin=sin(sinx);

printf("The sin of %lf is %lfn", sinx, resultsin);

getche();

}

else if(choice2=='7') {

clrscr();

printf("This system compute Cos x n");

printf("Enter number ");

scanf("%lf",&cosx);

resultcos=cos(cosx);

printf("The Cos of %lf is %lfn", cosx, resultcos);

}

else if(choice2=='8') {

clrscr();

printf("This project ascertain Tan x n");

printf("Enter number ");

scanf("%lf",&tanx);

resulttan=tan(tanx);

printf("The Tan of %lf is %lfn", cosx, resultcos);

}

}
 
Top