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
6
void
GetSinCos
(
int
degree,
double
*dSin,
double
*dCos) {
7
*dSin = sin(degree *
PI
/ 180);
8
*dCos = cos(degree *
PI
/ 180);
9
}
10
11
int
main
()
12
{
13
double
dSin;
14
double
dCos;
15
int
degree;
16
scanf(
"%d"
, °ree);
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
}
GetSinCos
void GetSinCos(int degree, double *dSin, double *dCos)
Definition
sincos.c:6
PI
#define PI
Definition
sincos.c:3
main
int main()
Definition
sincos.c:11
Module10
sincos.c
Generated on Sun Sep 29 2024 16:39:53 for COMP2113 by
1.12.0