Skip to content

Commit f63e70a

Browse files
type casting
1 parent 0510513 commit f63e70a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Diff for: operators/type_casting.c

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include <stdio.h>
2+
3+
int main() {
4+
float average;
5+
int total = 23;
6+
int count = 4;
7+
8+
average = (float) total / count;
9+
/* average = 5.75 */
10+
printf("average = %.2f\n", average);
11+
return 0;
12+
}

0 commit comments

Comments
 (0)