Question: 2. (20 points) Here are four C programs to tratushte bituary to derimal; that is, you rum *. / pb101 ? and it will print

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

2. (20 points) Here are four C programs to tratushte bituary to derimal; that is, you rum *. / pb101 ? and it will print ' 5 '. For each program, indicate whether it works. If it does not, shom lions to fix it by changing the ferest characters possible. Note that these programs will crabl if not given an argument; that's not considered an error per the design spec. Program A Works as is. Needs fixing \#include \#include \#include int main (int argc, char *argvD) i int val=0; // varning: assumes argv[1]! int len =strlen(argv[1]); for (int 1=0;1 int main (int arge, char *argv[) i intval=0; // warning: assumes argv[1]! int len = strlen (argv[1]); for (int i=0;i Hinclude stdiib . b Hinclude string. h > int main(int argc, char *argvD) t int val=0 : // tarming: assumes argv [1]! int len - strlen(argy [1]) - 1; for (int 1=1 en; 1>0;11} if (argv[1][1]=1) val I=1I en; 3 printf("\%d ", val); r Program D Works as is. Nerds fixing: \#include stdio h \#include \#include int main(int argc, char *argv [) t int val =0; // varning: assunes argv[1]! int len = strlen (argv[1])1; for (int i=1 en; 1>=0;1 ) \{ val +=(argv[1][i]0 ') (aen1); \} 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!