0

To convert sq.ft to acres by c language

Acre=sq.ft/43620.1704 Mandatory test case1: float trackLand, trackLandAcred Mandatory test case 2: scanf Mandatory test case 3 : printf https://code.sololearn.com/cch2wg9N7BlE input :45587.23 And output : 45587.23 sq.ft is equal to 1.05 acres I got everything correct but my mandatory test case 1 failed..... I am not sure where I made mistake

20th Oct 2021, 2:22 AM
morgan
morgan - avatar
14 Réponses
+ 1
Maybe you're printing the words wrong, for example "acres" instead of "Acres". Check these kind of mistakes. Also prefer double to float when storing this kind of accuracy-needed values. Try and say the result. All the best =)
20th Oct 2021, 2:43 AM
Rishi
Rishi - avatar
+ 1
May your test cases failing because of formatting your read input and output format properly Click on first test case and see what your output showing Once try this #include <stdio.h> int main() { float trackLand,trackLandAcred; scanf("%f", &trackLand); trackLandAcred=trackLand/43620.1704; printf("%.2f is equal to %.2f acres",trackLand ,trackLandAcred); return 0; }
20th Oct 2021, 2:45 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
Can u provide me link where u testing
20th Oct 2021, 3:07 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
Once show failed test case screenshot what input your compiler expecting
20th Oct 2021, 3:25 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
I think your test case failing because of constraints their is constraints your input should be between 20000.00 to 70000.00 U have to check this also your input is between these numbers or not just use simply if statement with &&
20th Oct 2021, 4:09 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
Your variable declaration should be: "float tractLand, tractLandAcred;" But you did it as: "float trackLand, trackLandAcred;" While your mistake is solved, all these information should not be validated by the code editor (like the variable names and stuff). This stops the students from doing stuff on their own. All the best =)
20th Oct 2021, 5:03 AM
Rishi
Rishi - avatar
0
Actually output should be in acres not Acres
20th Oct 2021, 3:02 AM
morgan
morgan - avatar
0
I tried this way output is correct but mandatory test case 1 failed
20th Oct 2021, 3:04 AM
morgan
morgan - avatar
0
Sorry,Actually I am doing my school homework so I can't share the link because I have to say everything like user name, password ....
20th Oct 2021, 3:24 AM
morgan
morgan - avatar
20th Oct 2021, 3:57 AM
morgan
morgan - avatar
0
https://prntscr.com/1wsua7a
20th Oct 2021, 3:57 AM
morgan
morgan - avatar
20th Oct 2021, 3:58 AM
morgan
morgan - avatar
0
Thank you very very much
20th Oct 2021, 5:23 AM
morgan
morgan - avatar
0
#include <stdio.h> int main() { float tractLand,tractLandAcred; scanf("%f",&tractLand); tractLandAcred=tractLand/43560; printf("%.2f sq.ft is equal to %.2f acres",tractLand,tractLandAcred); return 0; }
3rd Apr 2022, 11:37 AM
Karthik