COMP2113
COMP2113_ENGG1340 Programming technologies and Computer programming II [Section 2BC] [2023]
Loading...
Searching...
No Matches
sincos.c
Go to the documentation of this file.
1#include <stdio.h>
2#include <math.h>
3#define PI 3.14159265
4
5// Task 2. Build the GetSinCos() function
6void GetSinCos(int degree, double *dSin, double *dCos) {
7 *dSin = sin(degree * PI / 180);
8 *dCos = cos(degree * PI / 180);
9}
10
11int main()
12{
13 double dSin;
14 double dCos;
15 int degree;
16 scanf("%d", &degree);
17 GetSinCos(degree, &dSin, &dCos);
18 // Task 1. Read in user input to variable degree
19 // Task 3. Call the GetSinCos() function
20 printf("The sin is %g \n", dSin);
21 printf("The cos is %g \n", dCos);
22
23 return 0;
24}
void GetSinCos(int degree, double *dSin, double *dCos)
Definition sincos.c:6
#define PI
Definition sincos.c:3
int main()
Definition sincos.c:11