From f587c04943c879f3c426b04867a7e224dd5f2326 Mon Sep 17 00:00:00 2001 From: Sokhon Chhun <47809100+SokhonC@users.noreply.github.com> Date: Wed, 6 Mar 2019 10:11:40 +0700 Subject: [PATCH] Update to calculator.c I add one more function about calculate the delta=b^2-4*a*c --- calculator.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/calculator.c b/calculator.c index 71fe13a..76ab076 100644 --- a/calculator.c +++ b/calculator.c @@ -2,11 +2,12 @@ main() { char chc; - float a,b,c; + float a,b,c,delta; puts("+ for Addiction"); puts("- for Substraction"); puts("* for Multiplication"); puts("/ for Division"); + puts("$ for findind the delta"); puts("Select your choice :"); fflush (stdin); chc = getchar(); @@ -32,6 +33,12 @@ main() c=a/b; printf("The answer is %f",c); break; + case '$': + printf("Enter the value for c :"); + scanf("%f",&c); + delta=b*b-(4*a*c); + printf("The answer of delta is %f",delta); + break; default : puts("Syntax Error"); }