Question

In: Computer Science

Please Use C language to Make a calculator. Make sure calculator is able to take up...

Please Use C language to Make a calculator. Make sure calculator is able to take up to 5 values. Try to make calculator using simple coding As you can.

Please create a simple calculator with only +, -,* and divide. It has to be able to enter any numbers (including decimals) and be able to do the following functions:

+, -, divide and multiply.

Please have the answers, always rounded to two decimal figures. The calculator will also have to be able to take up to 5 values.

Solutions

Expert Solution

#include <stdio.h>

int main()
{
double a,b,add,sub,mul,di;
int ch;
char ch2;
do{
printf("\nEnter the first number: ");
scanf("%lf",&a); //Taking input from user
printf("\nEnter the second number: ");
scanf("%lf",&b); //Taking input from user
printf("\nEnter 1 for addition ");
printf("\nEnter 2 for subtraction ");
printf("\nEnter 3 for multiplication ");
printf("\nEnter 4 for division ");
printf("\nEnter your choice: ");
scanf("%d",&ch); //Taking choice from user
switch(ch)
{
case 1:add=a+b; //performing addition
printf("\nAddition is:%.2lf",add); //printing the result
break;
case 2:sub=a-b; //performing subtraction
printf("\nSubtraction is:%.2lf",sub); //printing the result
break;
case 3:mul=a*b; //performing multiplication
printf("\nMultiplication is:%.2lf",mul); //printing the result
break;
case 4:di=a/b; //performing division
printf("\nDivision is:%.2lf",di); //printing the result
break;
default:
printf("\nEnter valid choice");
}
printf("\nDo you want to continue?");
scanf("%s",&ch2); //Taking choice from user
}while(ch2=='y'||ch2=='Y');

return 0;
}
Output:-


Related Solutions

make a calculator in C++ or C language that can take up to 5 values at...
make a calculator in C++ or C language that can take up to 5 values at same time
The Programming Language is C++ PLEASE, Make sure to read the requirements and grading criteria for...
The Programming Language is C++ PLEASE, Make sure to read the requirements and grading criteria for homework first... Thank you!!! Objective: The purpose of this project is to expose you to: One-dimensional parallel arrays, input/output, Manipulating summation, maintenance of array elements. In addition, defining an array type and passing arrays and array elements to functions. Problem Specification: Using the structured chart below, write a program to keep records and print statistical analysis for a class of students. There are three...
C++ CODE PLEASE MAKE SURE TO USE STRINGSTREAM AND THAT THE OUTPUT NUMBER ARE CORRECT 1....
C++ CODE PLEASE MAKE SURE TO USE STRINGSTREAM AND THAT THE OUTPUT NUMBER ARE CORRECT 1. You must call all of the defined functions above in your code. You may not change function names, parameters, or return types. 2. You must use a switch statement to check the user's menu option choice. 3. You may create additional functions in addition to the required functions listed above if you would like. 4. If user provides option which is not a choice...
Use C++ please You will be building a linked list. Make sure to keep track of...
Use C++ please You will be building a linked list. Make sure to keep track of both the head and tail nodes. (1) Create three files to submit. PlaylistNode.h - Class declaration PlaylistNode.cpp - Class definition main.cpp - main() function Build the PlaylistNode class per the following specifications. Note: Some functions can initially be function stubs (empty functions), to be completed in later steps. Default constructor (1 pt) Parameterized constructor (1 pt) Public member functions InsertAfter() - Mutator (1 pt)...
Please make sure to display your thought process? It is important to be able how the...
Please make sure to display your thought process? It is important to be able how the answer was deduced. A certain extruder for plastics was found to work best at a melt viscosity of 2 X 104 Pa-s. The polymer of choice had this viscosity at 145 °C when its DP­w was 700. This polymer has a Tg of 75 °C. Because of polymerization kinetics miscalculation by someone who did not take polymer science, today’s polymer has DPw of 500....
Please make sure to display your thought process? It is imperative to be able to follow...
Please make sure to display your thought process? It is imperative to be able to follow how the answer was deduced. Please be as thorough as possible. Please address all parts of this question. The effective life of a component in an aircraft engine is modeled as a random variable with mean value 5000 hours and standard deviation 40 hours. The engine manufacturer introduced an improvement into the manufacturing process for this component that increases the mean life to 5050...
Please make sure to display your thought process? It is imperative to be able to follow...
Please make sure to display your thought process? It is imperative to be able to follow how the answer was deduced. Please be as thorough as possible. Please address all parts of this question. A team of medical researchers wants to estimate the malaria infection rate in a difficult-to-access jungle region of [No Name Country]. There are 80 villages in the studied part of the jungle, which can be assumed to be rather similar to each other. Each village has...
Please make sure to display your thought process? It is imperative to be able to follow...
Please make sure to display your thought process? It is imperative to be able to follow how the answer was deduced. Please be as thorough as possible. Please address all parts of this question. Consider a hypothesis test for the population mean value. A) Explain the concept of type I and type II errors, with error probabilities denoted by a and b. B) How do we decide whether to use one-sided or two-sided hypothesis tests? Give an example for both...
Please make sure to display your thought process? It is imperative to be able to follow...
Please make sure to display your thought process? It is imperative to be able to follow how the answer was deduced. Please be as thorough as possible. Please address all parts of this question. A team of medical researchers wants to estimate the malaria infection rate in a difficult-to-access jungle region of [No Name Country]. There are 80 villages in the studied part of the jungle, which can be assumed to be rather similar to each other. Each village has...
Please make sure to display your thought process? It is imperative to be able to follow...
Please make sure to display your thought process? It is imperative to be able to follow how the answer was deduced. Please be as thorough as possible. Please address all parts of this question. A team of medical researchers wants to estimate the malaria infection rate in a difficult-to-access jungle region of [No Name Country]. There are 80 villages in the studied part of the jungle, which can be assumed to be rather similar to each other. Each village has...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT