Help me please with HW Structured Program Development in C Homework Assignment #
ID: 3672576 • Letter: H
Question
Help me please with HW
Structured Program Development in C Homework Assignment #4 (6%) Due Date: March 2, 2016 Teb2 Some homework problems taken directly from the textbook: 1) Write a C statement io accomplish each of the ollwing a) Test if the value of variable count is greater than 10. If it is, print "Count is greater than 10. b) Calculate the remainder after q is divided by divisor and assign the result to q. c) Test i to see if it is less than or equal to y and if it is, print "i is less than y." d) Test if gender is equal to 1, if it is print "Woman" or else print "Man" 2) What value is assigned to X when Y is 15.0? a. X 25.0; if(Y != (X-10.0)) else if ((Y = 0.0)) else X-X-10.0; X-X/2.0; b, 3) What is the error in the following code segments: a) switch (n) ( case 1: printf ("The number is lIn") case 2: printf (The number is 2n" break default printf (The number is not 1 or 2un"); break;Explanation / Answer
Please find the required solution:
1.
a) if(count>10)
printf("Count is greater than 10");
b) q=q%divisor
c) if(i<=y)
printf("i is less than y");
d) if(gender==1)
printf("Woman");
else
printf("Man");
2.
a. X=25.0 given Y=15.0
if(Y != (X-10.0)) 15.0 !=(25.0-10.0)
X=X-10.0; 15.0 !=(15.0) false
else
X=X/2.0; X=25.0/2.0=12.5
given Y=15.0
b. if((Y<15.0) and (Y>=0.0)) false
X=5*Y;
else
X=2*Y; X=2*15.0=30.0
3. a) No error .(May be case 1 require break statement)
b) if(x==y);(No error)
x=10;(May be is ; not required)
c) if(y=3) (error)
y=y+1;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.