if ((k == 1) || (k == 2)) j = 2 * k - 1 if ((k == 3) || (k == 5)) j = 3 * k + 1 if (k == 4) j = 4 * k - 1 if ((k == 6) |

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

if ((k == 1) || (k == 2)) j = 2 * k - 1 if ((k == 3) || (k == 5)) j = 3 * k + 1 if (k == 4) j = 4 * k - 1 if ((k == 6) |

Post by answerhappygod »

if ((k == 1) || (k == 2)) j = 2 * k -1
if ((k == 3) || (k == 5)) j = 3 * k +1
if (k == 4) j = 4 * k - 1
if ((k == 6) || (k == 7) || (k == 8))j = k - 2
Please add the input statements and output statements to displaythe results, i.e., you need to ask for the input of k and thendisplay the value of j. In your lab report, please display atleast three cases of different input of k and their correspondingoutput of j.
j = -3;
key = j + 2;
for (i = 0; i < 10; i++){
if ((key == 3) || (key == 2))
j--;
else if (key == 0)
j += 2;
else j = 0;
if (j > 0)
break;
else j = 3 - i;
}
Please add output statements to display the results.
*
**
***
If the input is 6, such an array willbe printed. * in row 1, two *s in row 2, and so on.
*
**
***
****
*****
******
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply