This need to be write in c programming languange I really need help with this as
ID: 674305 • Letter: T
Question
This need to be write in c programming languange
I really need help with this asap can any one help me with this code
Instructions - Math library functions cannot be used to complete these tasks
Print instructions explaining how to operate the calculator
Allow the user to continue entering calculations until they quit the program
Allow the user to perform the following operations:
add ( + ) should add to doubles
subtract ( - ) should subtract to doubles
multiply ( * ) multiply two doubles
divide ( / ) divide two doubles, do not allow division by zero
power ( ^ ) a double and an integer, calculate the double raised to the integer. zero and negative exponents should work.
exponential ( e ) raise the constant e to the power of the integer provided. zero and negative exponents should work. (you must define the constant)
factorial ( ! ) given an integer, calculate the factorial. store your result as a long
random range ( r ) given two integers, generate a random integer between the two integers (inclusively). Be sure the lower bound is less than the upper bound
sum range ( s ) calculate the sum of consecutive integers between two given integers (inclusively)
round ( ~ ) given a double, round to the nearest integers
roundup ( ' ) given a double, round to the nearest integers
rounddown ( _ ) given a double, round to the nearest integers
minimum ( < ) given two doubles, determine the lesser
maximum ( > ) given two doubles, determine the greater
Allow the user to input the calculation all at once (examples below)
+ 3 4
/ 4.3 2.3
^ 3.1 2
r 5 10
Your code must meet the following technical specifications
use at least two variables of different types
no global variables allowed
use a constant, global constants are ok
use at least one if or if else statement
use at least one switch statement
use at least one for loop
use at least one while or do while loop
use at least three functions with prototype.
at least one must return a value
at least one must take input
Comment
Explanation / Answer
#include <stdio.h>
#include <math.h>
int main(int argc, const char * argv[])
{
/* Define temporary variables */
double value1, value2;
double result;
/* Assign the values we will use for the pow calculation */
value1 = 4;
value2 = 2;
/* Calculate the result of value1 raised to the power of value2 */
result = pow(value1, value2);
/* Display the result of the calculation */
printf("%f raised to the power of %f is %f ", value1, value2, result);
return 0;
}
#include <stdio.h>
#include <math.h>
int main()
{
float result,value;
printf("Input a float value: ");
scanf("%f",&value);
result = sqrt(value);
printf("The square root of %.2f is %.2f ",
value,result);
result = pow(value,3);
printf("%.2f to the 3rd power is %.2f ",
value,result);
result = floor(value);
printf("The floor of %.2f is %.2f ",
value,result);
result = ceil(value);
printf("And the ceiling of %.2f is %.2f ",
value,result);
return(0);
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.