summaryrefslogtreecommitdiff
path: root/userspace
diff options
context:
space:
mode:
Diffstat (limited to 'userspace')
-rw-r--r--userspace/Makefile2
-rw-r--r--userspace/add.c10
2 files changed, 8 insertions, 4 deletions
diff --git a/userspace/Makefile b/userspace/Makefile
index 3e4a00f..8516bc1 100644
--- a/userspace/Makefile
+++ b/userspace/Makefile
@@ -7,6 +7,7 @@ CFLAGS+=-w
CFLAGS+=-std=gnu11
CFLAGS+=-O3
+
PROGS=foolshell ls simple brainfuck add checker clear task1 task2 init
ext2.img: $(PROGS)
@@ -32,6 +33,7 @@ brainfuck: brainfuck.o
foolshell: foolshell.o
simple: simple.o
add: add.o
+ $(CC) -o $@ $< -lm
checker: checker.o
task1: task1.o
task2: task2.o
diff --git a/userspace/add.c b/userspace/add.c
index 3a624be..04f7f17 100644
--- a/userspace/add.c
+++ b/userspace/add.c
@@ -2,12 +2,13 @@
#include <string.h>
#include <stdint.h>
#include "../fs/fs.h"
+#include <math.h>
int main(int argc, char **argv)
{
- int sum=0;
- int i=0;
+ float sum=0;
+ float i=0;
char *buf=malloc(256);
puts("\n*** fools calculator ***");
@@ -26,8 +27,9 @@ int main(int argc, char **argv)
if(i!=0)
{
puts("--------");
- printf("sum = %i \n",sum);
- printf("avg = %i \n\n",sum/i);
+ printf("sum = %f \n",sum);
+ printf("avg = %f \n",sum/i);
+ printf("sin(avg) = %f \n\n",sin(sum/i));
}
return 0;