LINK TO MY SUBMISSION : HS08TEST Problem - CodeChef
PLEASE LET ME KNOW ! WHERE I HAVE BEEN STUCKED!
thanks in advance,
regards
thiyagarajan
LINK TO MY SUBMISSION : HS08TEST Problem - CodeChef
PLEASE LET ME KNOW ! WHERE I HAVE BEEN STUCKED!
thanks in advance,
regards
thiyagarajan
0.5 dollars
charge for each transaction ???Let’s assume you had 5 dollars in your account… And you withdraw 5 dollars from it…
Now what about 0.5
dollars charge ??? bank cannot allow negative balance
so you need to check…
if( X+0.5 less than Y)
instead of
if(X less than Y)
welcome bro
#include <stdio.h>
void money(int X,float Y){
if(X%5==0){
if((X+0.5)<=Y){
printf("%.2f",(Y-(X+0.5)));
}
else
{
printf("%.2f",Y);
}
}
else{
printf("%.2f",Y);
}
}
int main(void) {
// your code goes here
int x;
float y;
money(x,y);
return 0;
}
Can you please tell whats wrong in these
You forgot to take the input.
Just take the input , else everything seems fine.
#include <bits/stdc++.h>
using namespace std;
int main() {
int withdraw;
float balance;
scanf("%d %f", &withdraw, &balance);
if((withdraw>0 && withdraw<=2000) && (balance>=0 && balance<=2000))
{
if((withdraw % 5 ==0)&& (balance>withdraw+0.50))
{
printf("%.2f\n", balance-withdraw-0.50);
}
else
{
printf("%.2f\n", balance);
}
}
return 0;
}
i am not getting whats wrong in my code please help!