can anyone tell why its wrong . when i use to run my program in my own dev cplus plus compiler its running . but ater submitting it shows wrong answer error
#include<stdio.h>
int main()
{
float y;
int x;
scanf("%d %f",&x,&y);
if(x<y&&(x%5==0))
printf("%.2f",y-x-0.5);
else
printf("%.2f",y);
return 0;
}
#include
using namespace std;
int main()
{
int n,ch;
cin>>n>>ch;
float sum=0;
if((n+0.5<=ch)&&(n%5==0))
{
sum=ch-(n+0.5);
cout<<sum<<"\n";
}
else
{
sum=ch;
cout<<sum<<"\n";
}
return 0;
}
What is wrong with mine code, codechef Judge is giving it wronf Answer??? PLease Help
#include<stdio.h>
int main()
{
int x;
float y , z;
scanf("%d",&x);
scanf("%f",&y);
if(y>=0 && y<=2000);
{
if(x!=0 && x%5==0 && x<y)
printf("%f",y-x-0.50);
}
if(x%5!=0 || x>y )
printf("%f",y);
if(x==0 || x==y)
printf("%f",y);
return 0;
}
what is wrong with the code any one can run it on code blocks and can check it
i have to copy other’s code to proceed further
#include<stdio.h>
main()
{
int x,y,p;float z;
printf(“enter the initial account balance”);scanf("%d",&y);printf(“enter the amount you want to withdraw”);scanf("%d",&x);
p=x%5;
if((0<=x<=2000)&&(0<=y<=2000)&&(x<y)&&(p==0))
{z=y-x-0.5;printf(“the current account balance is %.2f”,z);}
else
printf(""%.2f",(float)y);
}
#include<stdio.h>
main()
{
int x,y,p;float z;
printf(“enter the initial account balance”);scanf("%d",&y);printf(“enter the amount you want to withdraw”);scanf("%d",&x);
p=x%5;
if((0<=x<=2000)&&(0<=y<=2000)&&(x<y)&&(p==0))
{z=y-x-0.5;printf(“the current account balance is %.2f”,z);}
else
printf(""%.2f",(float)y);
}