Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C program that simulates a die rolling game. Before starting the game, t

ID: 3810543 • Letter: W

Question

Write a C program that simulates a die rolling game. Before starting the game, two players will choose the side. One will choose the add part(1, 3 or 5 points and we call thi8s player is Player 1) and the other chooses the even part (2, 4 or 6 points, Player 2). To start, a referee will roll a six sided die which is a random value from 1 to 6. The player who attains 3 times first will be announced as the winner. The program should function only once (no need to loop the program.) Now, start the game... Roll 1: 6 Roll 2: 1 Roll 3: 2 Roll 4:3 Roll 5:4 The winner is player 2.... Function (20 th) - Define function prototype Write a C function that reads two float values x and y in degree. The function will calculate and print the results (2 decimal point format, i.e. 1.23) from the following equation on the scree: f(x) = 4*sin^2 (2x) - 2* cos^3(y): Then, develop a C program that calls the function above. Example output: Enter two angles (float values in degree): 57.3 24.5 f(57.3, 24.5) = 1.80 Function (15th) - Define directly function definition Write a recursive function that accepts an integer n and returns the result of the following equation: f(n) = 1^2 + 2^3 + 3^4 + ... + n^n+1 Then, develop a C program that reads an integer N and displays the result after calling the function above. Example output: f(5) = 16739

Explanation / Answer

#include<stdio.h>
#include<math.h>
#define PI acos(-1) //PI is cos inverse -1
void main() {
   double x,y,results,a,b;
   printf("Enter two angles (float value in degrees): ");
   scanf("%lf %lf",&a,&b);
   x = a*PI/180; //convert from degree to radian
   y = b*PI/180;

   results = 4*pow(sin(2*x),2) - 2*pow(cos(y),3); //calulate results
   printf("f(%.2lf,%.2lf) = %.2lf",a,b,results);
}
   

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote