Skip to content

Commit

Permalink
split source / header
Browse files Browse the repository at this point in the history
  • Loading branch information
Tsuyoshi-Iwanaga committed Mar 18, 2021
1 parent ef6dd89 commit 7177a85
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
11 changes: 11 additions & 0 deletions c_sample/020/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* main.c */
#include <stdio.h>
#include "sum.h"

int main(void)
{
int value;
value = sum(50, 100);
printf("%d\n", value);
return 0;
}
7 changes: 7 additions & 0 deletions c_sample/020/sum.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* sum.c */
int sum(int min, int max)
{
int num;
num = (min + max) * (max - min + 1) / 2;
return num;
}
2 changes: 2 additions & 0 deletions c_sample/020/sum.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/*sum.h*/
int sum(int min, int max);

0 comments on commit 7177a85

Please sign in to comment.