-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmbeddedSystemDesign_HW_week3.3.c
More file actions
34 lines (29 loc) · 996 Bytes
/
EmbeddedSystemDesign_HW_week3.3.c
File metadata and controls
34 lines (29 loc) · 996 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
Make a function that converts thousandth of an inch (thou) to millimeters (mm) and returns decimal number of (mm). A integer value
of thousandth of an inch (1 thou - 100 thou) is passed as a parameter to the function. thou = mils.
For example:
Test | Result
------------------------------------------
unsigned int thou=100; | 2.5400
printf("%.4f",thou_to_mm(thou)); |
*/
#include <stdio.h>
#include <math.h>
//function prototype(s)
double thou_to_mm(double thou);
/*---------------------------------------------------------------------------------------------------------------------------------*/
//main function
int main(void)
{
unsigned int thou=100;
printf("%.4f\n",thou_to_mm(thou));
return 0;
}//end main
/*---------------------------------------------------------------------------------------------------------------------------------*/
//fuction(s) declaration
double thou_to_mm(double thou)
{
double result;
result = thou*0.0254;
return result;
}//end thou_to_mm