CS201 MID TERM SOLVED MCQs || PAST PAPERS || GROUP-1 || INTRODUCTION TO PROGRAMMING || VuTech Visit Website For More Solutions www.vutechofficial.blogspot.com …
CS508 ASSIGNMENT NO. 1 SPRING 2023 || 100% RIGHT SOLUTION || MODERN PROGRAMMING LANGUAGES || BY VuTech
Visit Website For More Solutions www.vutechofficial.blogspot.com
KINDLY, DON’T COPY PASTE
SUBSCRIBE, SHARE, LIKE AND COMMENTS FOR MORE UPDATES
Problem Statement:
The following code snippet contains some conditional (nested if else /else if based) statements. Which are difficult to understand as they do not contain any starting or ending keywords against each statement. You, being a programming language expert, are required to put "then" and "end if/else/else if" at appropriate places to get the desired result.
Code Snippet:
At start, x contains 100 (i.e. x = 100)
if (x > 50)
x = x * 5;
}if (x > 200){
x = x - 200;
}if (x > 350){
x = x - 150;
}else{
x = x + 150;
}
if (x > 400){
x = x - 150;
}if (x < 500){
x = x + 150;
}if (x == 500){
x = x + 200;
}else if (x > 400){
x = x - 100;
}else if (x < 650){
x = x + 100;
}else{
x = x * 5;
}
At end, x contains 350.
Solution
if (x > 50) then
x = x * 5;
end if;
if (x > 200) then
x = x - 200;
end if;
if (x > 350) then
x = x - 150;
else
x = x + 150;
end if;
if (x > 400) then
x = x - 150;
end if;
if (x < 500) then
x = x + 150;
end if;
if (x = 500) then
x = x + 200;
else if (x > 400) then
x = x - 100;
else if (x < 650) then
x = x + 100;
else
x = x * 5;
end if;
KINDLY, DON’T COPY PASTE SUBSCRIBE, SHARE, LIKE AND COMMENTS FOR MORE UPDATES SEND WHATSAPP OR E-MAIL FOR ANY QUERY 0325-6644800 kamranhameedvu@gmail.com Visit Website For More Solutions www.vutechofficial.blogspot.com
We provide Virtual University of Pakistan Study Materials such as Solution of Assignments, GDBs, Mid Term Solved Papers, Final Term Solved Papers, Mid Term Solved MCQs, and Final Term Solved MCQs. We also provide regular Semester Quizzes, Updated Handouts, and Short Questions and Answers. We help you with your research and many other educational-related topics, as far as we know. Furthermore, Share your problem with us and Please feel free to ask any related questions.