A Trap in scanf()

Hey everyone.......

Today i faced a problem ! !

That is in this below programme when i give a look for what are the reasons for giving me Errors I thought that may be the value i input are in degree and mathematical function in c are in Radian ,So i add a extra variable "x" to convert degree to radian ....But it runs the same problem.....
 



Then i go through all the program carefully and my eyes stuck on the "scanf("%0.2f",&y)".(Although i made it with a pretence of inputting Float number followed by 2 )...By seeing this i have some doubts . And i removed the "0.2" from the "%0.2f" and compile it.
WOW it's work.
 And i realise that use "%0.2f" in scanf is makes a trap for Fools..Here's the picture   - - -


So, Be carefull and does not make these mistakes as i do...
Always Remember - 
Don't Use filters in format strings in scanf() function


Thank You



Comments

Post a Comment