-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction.c
More file actions
45 lines (32 loc) · 761 Bytes
/
Copy pathfunction.c
File metadata and controls
45 lines (32 loc) · 761 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
35
36
37
38
39
40
41
42
43
44
45
/********************************************************
function.c
Copyright (c) 2011 Go Hosohara. All rights reserved.
********************************************************/
#include <stdio.h>
#include <stdlib.h>
/* プロトタイプ宣言 */
/* int get_loop_num(); */
/* void show_output(int) */
int get_loop_num()
{
char num_str[3];
printf("type number of loop[1-100]: ");
fgets(num_str,sizeof(num_str),stdin);
int num = atoi(num_str);
return num;
}
void show_output(int num){
printf("Count start !!\n");
int i = 0;
while (i < num){
sleep(1);
printf("%i\n",i+1);
i++;
}
printf("Count done !!\n");
}
int main(int argc, char** argv){
int lnum = get_loop_num();
show_output(lnum);
exit(0);
}