you just need the output as shows in output format…no extra string or anything like you did here…
printf("Enter withdraw amounte & balance: ");
printf("Pooja's Bank Balence: %0.4f",y);
you just need the output as shows in output format…no extra string or anything like you did here…
printf("Enter withdraw amounte & balance: ");
printf("Pooja's Bank Balence: %0.4f",y);
i didn’t find one…but it don’t process the correct output if the withdrawal amnt and balance is same…so check that third if block and correct it
#include
#include
using namespace std;
int main() {
int withdraw;
float amount=120.00,x,y;
cin>>withdraw;
if(withdraw % 5 == 0 && amount>=withdraw){
y=amount-withdraw-0.5;
cout<<fixed<<setprecision(2)<<y<<endl;
}
else
cout<<fixed<<setprecision(2)<<float(amount)<<endl;
return 0;
}
I have tried so many custom inputs and it is showing the correct output but when I submit it is showing wrong answer. can someone help
Please tell me what is wrong in this code!!!
#include <stdio.h>
int main()
{
int with;
float inib;
scanf("%d %f", &with,&inib);
if(with > 0 && with <= 2000 && inib>0 && inib<=2000){
if ( (with % 5) == 0 && with < inib)
{
printf("%.2f", (inib - with - 0.5));
}
else
{
printf("%.2f", inib);
}
}
return 0;
}
Consider the test input:
5 5.49
Thanks a lot!!!
#include <stdio.h>
int main(void) {
int wa;
float bal;
scanf("%d%f",&wa,&bal);
if(wa>1 && wa<=2000 && bal>=1 && bal<=2000)
{
if(wa%5==0 && wa<bal)
{
bal=bal-wa-0.5;
}
}
printf("%.2f",bal);
// your code goes here
return 0;
}
Whats worng in this code? HELP
Hello, i am brand new to coding, and to code chef. I am wondering why some code submissions are passing this test when they allow a negative integer for the withdraw amount, or a negative float for the balance amount, and are not checking for the max 2000 limit?
Can anyone tell me why this solution is not getting accepted
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int a;
float b,c;
cin>>a>>b;
if((a%5==0)&&(b>a+0.50))
{
c= (b- (a)-0.50);
cout<<fixed;
cout<<setprecision(2);
cout <<c;
}
else
{
cout<<fixed;
cout<<setprecision(2);
cout<<b;
}
}
CODECHEF SUCKS
#include
#include
using namespace std;
int main() {
int withdraw;
float balance,total;
cin>>withdraw;
cin>>balance;
if(withdraw>0 && withdraw%5==0){
if(withdraw==balance){
cout<<fixed<<setprecision(2)<<balance;
}
if(withdraw<balance){
total=balance-float(withdraw)-0.50;
cout<<fixed<<setprecision(2)<<total;
}
if(withdraw>balance){
cout<<fixed<<setprecision(2)<<balance;
}
}
else
cout<<fixed<<setprecision(2)<<balance;
return 0;
}
what am I doing wrong?
#include<bits/stdc++.h>
using namespace std;
void solve()
{
int x;float y;
cin>>x>>y;
if(x%5==0)
{
if(x<=y)
{
float ans=(y-.50)-x;
printf("%.2f\n",ans);
}
else
printf("%.2f\n",y);
}
else
printf("%.2f\n",y);
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
solve();
return 0;
}
What is wrong with my code?
Read the post directly before yours
Sorry
#include <stdio.h>
int main()
{
int x,y;
int v= 2000;
printf(“Balance:- %d\n”,y);
printf(“Enter the Withdrawl Amount:- “);
scanf(”%d”,&x);
printf(“Enter Balance”);
scanf("%d",&y);
if('0<x<=v' && '0<=y<=v')
{
if(x%5 == 0)
{
y= y-x-0.50;
printf("Remaining Balance:- %d\n",y);
printf("Amount withdrawed:- %d\n",x);
}
else if(x>y)
{
printf("insufficient fund");
}
else
{
printf("Transaction Error");
printf("%d\n",x);
printf("%d\n",y);
}
}
else
{
printf("Wrong Input Withdrawl amount should Less than equal to 2000");
}
}
can any one help me with it , its saying wrong solution
TRY THIS!!!
#include <stdio.h>
int main() {
int X;
float Y, balance=0;
scanf("%d%f", &X, &Y);
if (X % 5 != 0 || Y < X) {
printf("%f\n", Y);
}
else if (X % 5 == 0 && Y < (X + 0.50)) {
printf("%f\n",Y);
}
else if (X % 5 == 0 && Y >= (X + 0.50)) {
balance = Y - X - 0.50;
printf("%f\n",balance);
}
return 0;
}
Can anyone help and tell me whats the problem here?
My code :CodeChef: Practical coding for everyone