Skip to content

Commit d9a3f1e

Browse files
committed
add dynamic input
1 parent d2d9590 commit d9a3f1e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

C/Program-Timer/output.png

3.03 KB
Loading

C/Program-Timer/timer.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
#include<stdio.h>
33

44
// Placeholer function to edit:
5-
void function(int a, int b){
6-
printf("%d + %d = %d\n", a, b, a+b);
5+
void function(){
6+
int a, b;
7+
printf("Enter numbers to add(space separated):");
8+
scanf("%d %d", &a, &b);
9+
printf("Sum of %d and %d is %d.\n", a, b, a+b);
710
}
811

912
int main(int argc, char *argv[])
@@ -13,7 +16,7 @@ int main(int argc, char *argv[])
1316
and time the function.
1417
*/
1518
clock_t start = clock();
16-
function(23, 54);
19+
function();
1720
clock_t end = clock();
1821

1922
// Divide clock difference with CLOCKS_PER_SEC to convert time to seconds

0 commit comments

Comments
 (0)