Question

How to implement this function in C program and at the same time convert the result...

How to implement this function in C program and at the same time convert the result to degree? Use the C program and post a screenshot, please.

cos(2*pi*a/10.0)e^(-a/10.0)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

//required library is define
#include <stdio.h>
#include <math.h>

//a global variable PI defined whose value is 3.1429265
#define PI 3.1429265
int main () {
    //double type variable is declared
    double a;
    printf("Enter the value of a ");

    //value of a is taken as input
    scanf("%lf",&a);

    //cos() and exp() are the built in function defined in the <math.h> library
    //by default the cos() gives radian
    //by multiply the value with PI/180.0 we will get value of degree
    printf("%lf\n",cos(2*PI*a/10.0*PI/180)*exp(-a/10.0));
   return(0);
}

//screenshot is provided below

Add a comment
Know the answer?
Add Answer to:
How to implement this function in C program and at the same time convert the result...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1 Write a program to convert the time from 24-hour notation to 12-hour notation and vice...

    1 Write a program to convert the time from 24-hour notation to 12-hour notation and vice versa. Your program must be menu driven, giving the user the choice of converting the time between the two notations. Furthermore, your program must contain at least the following functions: a function to convert the time from 24-hour notation to 12-hour notation, a function to convert the time from 12-hour notation to 24-hour notation, a function to display the choices, function(s) to get the...

  • Write a C program for a program to implement a recursive main. Include a static local...

    Write a C program for a program to implement a recursive main. Include a static local variable count initialized to 1. Post increment and print the value of count each time the main is called. The loopcount included in the usage is a positive integer number that will indicate how deep the recursion should go. Usage: lab3 loopcount Code should be nicely indented and commented. Create a simple Makefile to compile your program into an executable called lab3. You should...

  • Create the Code using C Program: 2. Write a program to convert the time from 24-hour...

    Create the Code using C Program: 2. Write a program to convert the time from 24-hour notation to 12-hour notation and vice-versa. Your program must be menu driven, giving the user the choice of converting the time between the two notations. Furthermore, your program must contain at least the following function: a function to convert the time from 24-hour notation to 12-hour notation, a function to convert the time from 12-hour notation to 24-hour notation, a function to display the...

  • C++ DESIGN and IMPLEMENT a PROGRAM THAT WILL CONVERT A DECIMAL NUMBER to its HEXIDECIMAL VALUE....

    C++ DESIGN and IMPLEMENT a PROGRAM THAT WILL CONVERT A DECIMAL NUMBER to its HEXIDECIMAL VALUE. USE RECURSION TO ACCOMPLISH THIS. OUTPUT: The Original Number and its HEXIDECIMAL EQUIVALENT.

  • Write a C++ program that will convert distance measurements from miles to kilometers. Specifically, the program...

    Write a C++ program that will convert distance measurements from miles to kilometers. Specifically, the program needs to convert 0, 10, 20, 30, 40 , 50, 60, 70, 80, and 90 miles to kilograms displaying both the number of miles and the number of kilograms on the same line. please comment on what is pre and post condition too

  • No pointers please Urgent!!! Q5. Implement a C program that includes a function that copies one...

    No pointers please Urgent!!! Q5. Implement a C program that includes a function that copies one string into another string. You cannot use string.h library for this exercise. Use the following function prototype: void copystring(chars1 ().char s2[]); A sample run would be as follows: Please enter a string: cngcourse String 1 is copied to String 2 String 1 is cngcourse and String 2 is cngcourse

  • C++ only Implement a program that prompts a user to enter a number N where N...

    C++ only Implement a program that prompts a user to enter a number N where N is a positive number. The program must validate a user input and ask a user to re-enter until an input is valid. Implement a function that pass N as an argument and return a result of calculates N! (N-factorial): The function must use loop for the implementation. Hint: Factorial: N! = N * (N-1) * (N-2) * …. * 1 ( This is only...

  • Implement a C++ program that lets the user enter a number and then prints the result...

    Implement a C++ program that lets the user enter a number and then prints the result calculated by the following function. Write a recursive function that computes n * n/3 * n/9 * n/27 * n/81... where n is a non-negative integer, n/x is integer division and the quotient is always a multiple of 3 from the previous quotient. The sequence repeats as long as n/x > 0. For example: 27: 27 * 9 * 3 * 1 = 729...

  • This program needs to be written in C. Please use pointers. Implement a function that reverses...

    This program needs to be written in C. Please use pointers. Implement a function that reverses the bits of a decimal number represented with an unsigned char. For example: f (1) ! 128; In binary: f (00000001) ! 10000000 Your function must have the following properties: (a) Name: ReverseBits (b) Return type: unsigned char (c) Input: unsigned char

  • 1. Specification Write a C program to implement a simple calculator that accepts input in the...

    1. Specification Write a C program to implement a simple calculator that accepts input in the following format and displays the result of the computation: calc [operand_1] [operator] [operand_2] The operands operand_1 and operand_2 are non-negative integers. The operator is one of the following: addition (+), subtraction (-), multiplication (x), division (/) and modulo (%). Note: For the multiplication operator, use letter ‘x’. If you use the asterisk ‘*’, your program will not work properly 2. Implementation • The program...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT