QUESTION

Text
Image

please answer all of them or don't touch if u can't thanks


Assignment 3 1. Rewrite the following pseudocode segment using a loop statement in $\mathrm{C}$. Assume all variables are integer type. \[ k=(j+12) / 14 \] label: if $k>10$ then goto out \[ \begin{array}{l} \mathrm{k}=\mathrm{k}+3 \\ \mathrm{i}=3^{*} \mathrm{k}-1 \end{array} \] goto label out: ... 2. Rewrite the following code segment using a multiple selection statement in C. Assume all variables are integer type. \[ \begin{array}{l} \text { if }((\mathrm{k}==1) \|(\mathrm{k}==2)) \mathrm{j}=2^{*} \mathrm{k}-1 \\ \text { if }((\mathrm{k}==3) \|(\mathrm{k}==5)) \mathrm{j}=3^{*} \mathrm{k}+1 \\ \text { if }(\mathrm{k}==4) \mathrm{j}=4^{*} \mathrm{k}-1 \\ \text { if }((\mathrm{k}==6)\|(\mathrm{k}==7)\|(\mathrm{k}==8)) \mathrm{j}=\mathrm{k}-2 \end{array} \] 3. There is the following $\mathrm{C}$ program segment $\mathrm{j}=-2 ;$ for $(i=0 ; i<3 ; i++)\{$ $\quad$ switch $(j+2)\{$ $\quad$ case 3 : $\quad$ case $2: j--;$ break; $\quad$ case $0: j+=2 ;$ break; default: $j=0 ;$ \} if $(j>0)$ break; $j=3-i ;$ $\mathrm{j}=-2$; for $(i=0 ; i<3 ; i++)\{$ switch $(j+2)\{$ case 3 : case 2: j --; break; case 0 : $j+=2$; break; default: $\mathrm{j}=0$; \} if $(\mathrm{j}>0)$ break; $\mathrm{j}=3-\mathrm{i}$; \} - Represent the operational semantic of for statement - Represent the operational semantic of switch statement - Rewrite this C program segment by using if and goto statements in C:

Public Answer

LGVWX3 The First Answerer