From fbefa41fac301f28e1c2dbaab37b6856e803c3cb Mon Sep 17 00:00:00 2001 From: Charugoyal3 Date: Mon, 26 Oct 2020 14:01:04 +0530 Subject: [PATCH] added a c code of tcs exam --- program.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 program.c diff --git a/program.c b/program.c new file mode 100644 index 0000000..94348b7 --- /dev/null +++ b/program.c @@ -0,0 +1,43 @@ +#include + +int main() + +{ + + int n,k,j,m,p; + + float atebanana=0.0,atepeanut=0.0; + + scanf("%d %d %d %d %d",&n,&k,&j,&m,&p); + + if(n<0 || k<0 || j<0 || m<0 || p<0) + + { + + printf("INVALID INPUT"); + + } + + else + + { + + if(k>0) + + atebanana =(float)m/k; + + if(j>0) + + atepeanut =(float) p/j; + + n=n-atebanana-atepeanut; + + printf("Number of Monkeys left on the Tree:%d",n); + + } + + return 0; + +} + +