Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For each of the following pairs of scanf format strings ,indicate whether or not

ID: 3616579 • Letter: F

Question

For each of the following pairs of scanf format strings ,indicate whether or not the two strings are equivalent . If they 're not , show how they can be distinguished . (a) "%d"                        versus " %" (b) "%d-%d-%d"           versus "%d -%d -%d" (c) "%f"                         versus "%f " (d) "%f,%f"                   versus "%f, %f" For each of the following pairs of scanf format strings ,indicate whether or not the two strings are equivalent . If they 're not , show how they can be distinguished . (a) "%d"                        versus " %" (b) "%d-%d-%d"           versus "%d -%d -%d" (c) "%f"                         versus "%f " (d) "%f,%f"                   versus "%f, %f"

Explanation / Answer

a) Clearly they are not equivalent     Reason: %d takes integer values in scanf              while %does not know what values it will take b) They both are different.     For the first one you should give the input ase.g.: 12-20-30 but you cannot give as 12 - 20 - 30 (spaces inbetween_     but for the second one you can give the inputeither as 12-20-20 or 12 - 20 - 30 (both wil work wihtout anyerrors) c) Both are different...     For the first one...you can given input eitheras e.g. 12.5   or "12.5 " (i.e. space after 12.5)     The second one always waits for another input(you should give 12.5 space and another value like 1..then only itwill read 12.5) d) Both are the same     They will take input either as 12.5, 13.4 or12.5,13.4 (no space between both numbers)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote