From ace49d76e4935fec0cb0c1dbf714d5bbc20b034c Mon Sep 17 00:00:00 2001 From: Heart over Mind Date: Mon, 17 Oct 2022 13:47:49 +0545 Subject: [PATCH 1/2] Added Program for compound Interest --- C/.vscode/tasks.json | 28 ++++++++++++++++++++++++++++ C/compound_interest.c | 23 +++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 C/.vscode/tasks.json create mode 100644 C/compound_interest.c diff --git a/C/.vscode/tasks.json b/C/.vscode/tasks.json new file mode 100644 index 0000000..a6d8aad --- /dev/null +++ b/C/.vscode/tasks.json @@ -0,0 +1,28 @@ +{ + "tasks": [ + { + "type": "cppbuild", + "label": "C/C++: gcc.exe build active file", + "command": "C:\\MinGW\\bin\\gcc.exe", + "args": [ + "-fdiagnostics-color=always", + "-g", + "${file}", + "-o", + "${fileDirname}\\${fileBasenameNoExtension}.exe" + ], + "options": { + "cwd": "${fileDirname}" + }, + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "detail": "Task generated by Debugger." + } + ], + "version": "2.0.0" +} \ No newline at end of file diff --git a/C/compound_interest.c b/C/compound_interest.c new file mode 100644 index 0000000..179a2ad --- /dev/null +++ b/C/compound_interest.c @@ -0,0 +1,23 @@ +#include +#include + +int main(void){ + double principal, rate, amount; + int years, i; + + printf("Enter the principal: "); + scanf("%lf", &principal); + printf("Enter the rate: "); + scanf("%lf", &rate); + printf("Enter the number of years: "); + scanf("%d", &years); + + printf("Year\tAmount on deposit \n"); + + for (i = 1; i <= years; i++){ + amount = principal * pow(1 + rate, i); + printf("%d\t%.2f \n", i, amount); + } + + return 0; +} \ No newline at end of file From bb8ff331809bcddfea0506e23c34e86adb0323f6 Mon Sep 17 00:00:00 2001 From: Heart over Mind Date: Mon, 17 Oct 2022 13:55:59 +0545 Subject: [PATCH 2/2] Added Compound Interest Program --- C/.vscode/tasks.json | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 C/.vscode/tasks.json diff --git a/C/.vscode/tasks.json b/C/.vscode/tasks.json deleted file mode 100644 index a6d8aad..0000000 --- a/C/.vscode/tasks.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "tasks": [ - { - "type": "cppbuild", - "label": "C/C++: gcc.exe build active file", - "command": "C:\\MinGW\\bin\\gcc.exe", - "args": [ - "-fdiagnostics-color=always", - "-g", - "${file}", - "-o", - "${fileDirname}\\${fileBasenameNoExtension}.exe" - ], - "options": { - "cwd": "${fileDirname}" - }, - "problemMatcher": [ - "$gcc" - ], - "group": { - "kind": "build", - "isDefault": true - }, - "detail": "Task generated by Debugger." - } - ], - "version": "2.0.0" -} \ No newline at end of file