Question: 2. ( 20 points) Here are four C programs to tratushate binary to decimal; that is, you rua / plo 101 and it will

 2. ( 20 points) Here are four C programs to tratushate

2. ( 20 points) Here are four C programs to tratushate binary to decimal; that is, you rua " / plo 101 and it will print ' 5 '. For each program, indicate whether it works. If if does not, shour hoar to fix it hy changing the fewest characters possible. Note that these programs will crab if not given an argument; that's not considered an error per the design spec. Program A Works as is: Needs fixing. "include stdio, h> \#include \#include int main (int argc, char *argv[) i int val=0; // warning: assumes argv[1]! int len =strlen(argv[1]); for (int 1=0;1 Hinclude string. h> int main(int argc, char *argu(D) t int val=0; // warning: assumes argv[1]! int len - strlen(argv[1]) - 1; for (int 1=1 en; 1>0;10)t if (argv[1][1]=,1 ) val I=11 en; 3 print 1("d ",val); r Program D Works as is. Nends fixing. \#include \#include \#include int main(int argc, char *argv[) i int val =0; // warning: assunes argv[1]! int len =strlen(argv[1])1; for (int i=1 en; i>=0;1 ) } val+=(argv[1][1]0 ') (cen1); \} printf("%d ",val); \}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!