+ 4

What's wrong in this code..??

Every time I get the output as "Area is lesser than perimeter " even it is not https://code.sololearn.com/cHj314nyyxqm/?ref=app

1st Feb 2019, 10:08 PM
Rushi
13 Antworten
+ 5
scanf("%f%f",&a,&b); should probably be scanf("%f%f",&l,&b);
1st Feb 2019, 10:26 PM
Dennis
Dennis - avatar
+ 2
You are asking for a and b. scanf("%f%f",&a,&b); But A stands for area. are you looking for l and b
1st Feb 2019, 10:29 PM
sneeze
sneeze - avatar
+ 2
An easy way to debug this type of error is to print the numbers you entered back to the user before displaying the result. If you dont want that output in the final program simply comment it out. Use something like printf("Area %f length %f breadth %f peremiter %f", a, l, b, p); Then put // in front of the line when the program is working correctly.
2nd Feb 2019, 7:01 AM
Roger Greenlaw
+ 1
You havent included curly braces after if statement
2nd Feb 2019, 6:08 PM
@smike_designer!!🤓
@smike_designer!!🤓 - avatar
+ 1
@@smike_designer!!🤓 you don't really need to do this in some cases
2nd Feb 2019, 7:45 PM
Maneren
Maneren - avatar
+ 1
See the last line of code... it's just for fun :)
5th Feb 2019, 4:47 PM
Rushi
0
Thanks a lot bro....
1st Feb 2019, 10:28 PM
Rushi
0
I got that :)
1st Feb 2019, 10:29 PM
Rushi
0
U will get the meaning of char arry if you look at the end of the code.... it is just for fun. :)
3rd Feb 2019, 5:43 AM
Rushi
0
Take l and b more than 9,you will get a>p
4th Feb 2019, 3:42 PM
Veera Raghu
Veera Raghu - avatar
0
I'm curious about the char array t[ ] that you created. The printf("....", t); doesn't seem to use the array at all. I ran your code and didn't see it does anything with it.
5th Feb 2019, 4:08 PM
Roger Greenlaw