Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Pseudo Code of the program ? #include #include //function to perform the factorial calculation void facCal() { int number, i; while (1) { double factorial

Pseudo Code of the program ?

#include #include //function to perform the factorial calculation

void facCal() { int number, i; while (1) {

double factorial = 1; i = 1; //asking user to enter the value printf(" 1:Enter an integer to calculate its factorial value: If -99 is inserted:Factorial calc. is terminated "); scanf("%d", &number); if (number < 0&&number!=-99) { printf(" \aPlease enter a positive number! "); } else if (number == -99) { printf(" Exiting factorial calculator "); break; } else { while (i <= number) { factorial = factorial * i; i++; } printf("%d!=%lf ", number, factorial); } } }

void carCal() { int query; while(1) { printf(" 1:Enter the coordinates : 2:Exit "); scanf("%d",&query); if(query != 1) { printf(" Exiting coordinate calculator "); break; } float x,y,r,theta; const float pi=3.1415; scanf("%f%f",&x,&y);

r=sqrt(x*x+y*y); theta=atan(y/x); theta=theta*180/pi; printf(" cartesian cordinates %f %f:polar cordinates:%f,%f degree",x,y,r,theta); } }

// case 3 Fibonacci Sequence calculator void sequenceCal() {

int query; while(1) { int a=0,b=1,c,element,i,n,t1=0,t2=1,j;

printf(" 1:Enter element number of fibonacci sequence: 2:Exit "); scanf("%d",&query); if(query!=1) { printf(" Exiting fibonacci sequence calculator "); break; } scanf("%d",&element);

if(element==1){ printf("0"); } else if(element==2){ printf("0,1"); } else if (element<=0){ printf("\aplease enter valid integer!!!"); } else{ printf("%d,%d",a,b);

for(i=3;i<=element;i++){ int c=a+b; a=b; b=c; printf(",%d",c); } printf(" ");

c=0; for (i = 1; i <= element; i++) { for(j=1;j<=t1;j++){ printf("*"); } printf(" "); int c= t1 + t2; t1=t2; t2=c; } } }

} //main function int main() {

int select;

do{ printf("THIS IS THE MAIN CALCULATOR,PLEASE SELECT THE CALCULATOR "); printf("\t1:Enter into factorial calculator "); printf("\t2:Enter into polar coordinate calculator "); printf("\t3:Enter into Fibonacci Sequence calculator "); printf("\t4:Exit from main calculator ");

scanf("%d",&select);

switch(select) { case 1 :

facCal(); break; case 2: carCal(); break; case 3: sequenceCal(); break; case 4: printf(" Exiting from main calculator "); break; default: printf(" Invalid option ,Choose again ");

} }while(select!=4);

return 0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Current Trends In Database Technology Edbt 2006 Edbt 2006 Workshops Phd Datax Iidb Iiha Icsnw Qlqp Pim Parma And Reactivity On The Web Munich Germany March 2006 Revised Selected Papers Lncs 4254

Authors: Torsten Grust ,Hagen Hopfner ,Arantza Illarramendi ,Stefan Jablonski ,Marco Mesiti ,Sascha Muller ,Paula-Lavinia Patranjan ,Kai-Uwe Sattler ,Myra Spiliopoulou ,Jef Wijsen

2006th Edition

3540467882, 978-3540467885

More Books

Students also viewed these Databases questions