can i knw where i have done mistake?
#include<stdio.h>
int main()
{
int a;
float i;
printf("enter the value of a and i");
scanf("%d%f",&a,&i);
if(a%5==0 && a<i-0.5)
{
printf("%f",i-a-0.5);
}
else
{
printf("%f",i);
}
return 0;
}
can i knw where i have done mistake?
#include<stdio.h>
int main()
{
int a;
float i;
printf("enter the value of a and i");
scanf("%d%f",&a,&i);
if(a%5==0 && a<i-0.5)
{
printf("%f",i-a-0.5);
}
else
{
printf("%f",i);
}
return 0;
}
printf("enter the value of a and i");
Please read output format correctly and print only whats required.
Nostalgia for every coder ever. XD
What is the Problem That You are facing ?
A problem can arise for type conversion i.e. a < i-0.5 where a is an int and i is a float .
You can give a read to this http://www.geeksforgeeks.org/type-conversion-c/ .
His submission showed me WA, so I guessed that must be his problem :p.
BTW, a valid point, but its a lot more prominent in equality checking.