output initial: Please input your first Input: finitial, character output Please
ID: 3789471 • Letter: O
Question
output initial: Please input your first Input: finitial, character output Please input your last initial: Input: linitial, character Output: character, linitial, character. work correcth The initials you entered are finitial, statements (I recommend compiling and testing at this point to make sure your current Continue with the following statements: output: What is your age in years? Input years old, unsigned short integer output So you are yearsold, uns ned short integer years old output Please input the amount of energy used by the machine:Explanation / Answer
// C code
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <assert.h>
#include <string.h>
#include <ctype.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main()
{
char finitial, linitial;
printf("Please Input your first initial: ");
scanf(" %c",&finitial);
printf("Please Input your last initial: ");
scanf(" %c",&linitial);
printf("the initials you entered are %c and %c ",finitial,linitial);
unsigned short int age;
printf("What is your age in years: ");
scanf("%hu",&age);
printf("So you are %hu years old ", age);
double energy;
printf("Please input the amount of energy used by the machine: ");
scanf("%lf",&energy);
double work;
printf("Please input the amount of work done used by the machine: ");
scanf("%lf",&work);
double efficiency = work/energy*100;
printf("The efficiency of the machine is %5.1lf and it generated %6.2lf Joules of work ",efficiency,work);
double thetarad;
printf("Enter an angle in radians: ");
scanf("%lf",&thetarad);
printf("You input %lf. That is equal to %5.0lf degrees. ",thetarad,(thetarad*180/3.14));
printf("+---------------+--------------------+ ");
printf("Theta (radias) |%15f ",thetarad);
printf("sine (theta) |%15f ",sin(thetarad));
printf("cosine (theta) |%15f ",cos(thetarad));
printf("tangest (theta) |%15f ",tan(thetarad));
printf("+---------------+--------------------+ ");
return 0;
}
/*
output:
Please Input your first initial: a
Please Input your last initial: v
the initials you entered are a and v
What is your age in years: 24
So you are 24 years old
Please input the amount of energy used by the machine: 345
Please input the amount of work done used by the machine: 3444
The efficiency of the machine is 998.3 and it generated 3444.00 Joules of work
Enter an angle in radians: 1.05
You input 1.050000. That is equal to 60 degrees.
+---------------+--------------------+
Theta (radias) | 1.050000
sine (theta) | 0.867423
cosine (theta) | 0.497571
tangest (theta) | 1.743315
+---------------+--------------------+
*/
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.