×

# include<stdio.h>

int main() {

int x,m; float y,k,i=0.50; printf("input:\n"); scanf("%d\t%f",&x,&y); //scanf("%f",&y); k=y-i; m=x%5; if(x<y) { if(m!=0)

  printf("output:\n%.2f\n",y);

else
printf("output:\n%.2f\n",k-x);


} if(x>y) { printf("output:\n%.2f\n",y); } return 0; }

2★pravi1
62
accept rate: 0%

 1 Buddy we have to print as such as in the format specified. The output they have asked is to print the balance. No need to print input and Output and all Hope you got what i meant :) Here is the corrected code here answered 25 Jun '14, 22:54 3★bipin2 3.1k●25●46●71 accept rate: 8%
 0 First of all you should not print input: and output: . Then transaction is accepted if the charges can also be subtracted , so you should compare x with k. here is your corrected code : Code answered 25 Jun '14, 23:00 4★the65bit 1.1k●10●13●28 accept rate: 13%
 0 There shouldn't be anything to be printed except the answers.Not even "input " or "output".Also you should not use "\t" during taking input as it will only accept the input if there will be tab which is not here.So you should take the input without any tab answered 25 Jun '14, 23:01 3★prerakd 69●1●3●16 accept rate: 0%

Why am I getting wrong answer?

# include <stdio.h>

int main() {

int with;
float cur;

scanf("%d", &with);
scanf("%f", &cur);

if (with % 5 == 0 && cur - 0.5 > with)
{
printf("%.2f", cur-with-0.5);

}
else if (with % 5 != 0|| cur<=with)
printf("%.2f", cur);

return 0;


}

2★manan904
1
accept rate: 0%

 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×190

question asked: 25 Jun '14, 22:47

question was seen: 693 times

last updated: 25 Jul '16, 22:36