We have been working very hard since 2009 to facilitate in learning Read More. We can't keep up without your support. Donate.

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More

CS508 Assignment 01 Fall 2020 Solution / Discussion

Problem Statement:

Problem Statement:The following code snippet contains some conditional (nested if else based) statements. Which are difficult to understand as they do not contain any starting or ending keywords against each statement. You, being a programing language expert, are required to put "then" and "end if/else" 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 > 500)          x = x - 350          if (x > 350)          x = x - 150          else          x = x + 150          else          x = x - 100          if (x > 500)          x = x - 150          if (x < 500)           x = x + 150          if (x == 500)           x = x + 200          else          x = x + 100          if (x > 650)          x = x - 100          else if (x < 650)          x = x + 100          else          x = x * 5          else          x = x + 50
At end, x contains 3250.Note: This is a language-free code, which does not require any specific programming language to compile or execute. You are simply required to guess the flow of execution on the basis of value of x and put "then" and "end if/else" at appropriate places (see the hint given below). Furthermore, you can also add extra lines or spaces in your solution as well.
Hint:
 Difficult to Understand Easily Understandable    if (a > b)b = 5elsea = 5 if (a > b) thenb = 5end ifelse thena = 5end else  


+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)


Views: 934

Replies to This Discussion

          if (x > 500)

          x = x - 150

          if (x < 500)

          x = x + 150

          if (x == 500)

          x = x + 200

          else

          x = x + 100

          if (x > 650)

          x = x - 100

          else if (x < 650)

          x = x + 100

          else

          x = x * 5

          else

          x = x + 50

 

At end, x contains 3250.

Note:

This is a language-free code, which does not require any specific programming language to compile or execute. You are simply required to guess the flow of execution on the basis of value of x and put "then" and "end if/else" at appropriate places (see the hint given below). Furthermore, you can also add extra lines or spaces in your solution as well.

 

Hint:

 

Difficult to Understand

Easily Understandable

if (a > b)

b = 5

else

a = 5

if (a > b) then

b = 5

end if

else then

a = 5

end else

 

 

 

 

Good Luck

CS508 Assignment No. 1 Fall 2020 Solution by VU ACADEMY

#CS508 #CS508Assignment1 #CS508AssignmentSolution #CS508SolvedAssignment #CS508Assignment1Solution2020 #CS508Assignment1Fall2020 #CS508ssignmentSolution #CS508Networking #CS508AssignmentNo1 #CS508Assignment1Solution2020 #CS508Solution #CS508Assignment1Solution2020 #CS508SolutionLink #CS508Assignment1Solution2020 #CS508DownloadLink #CS508AssignmentPDF #CS508Assignment1Solution2020 #CS508AssignmentSolution #CS508File #CS508Assignment #CS508Assignment1Solution2020 #CS508AssignmentDownload #CS508Solve #CS508Assignment1Solution2020 #CS508Assignment1 #CS508Assignment1Solution2020 CS508Assignment1Solution2020, CS508Assignment1Solution2020, CS508Assignment1Solution2020, CS508Assignment1Solution2020, CS508Assignment1Solution2020, CS508Assignment1Solution2020, CS508Assignment1Solution2020, CS508Assignment1Solution2020,

#CS5008 Assg No 1 :

Simple way of solution Assignment no.1 cs 508

Cs 508 Assignment full solution simple

CS508 Assignment 1 Fall 2020 Solution
#vu #cs508 #AssignmentHelp #assignment #vustudent

link below 

CS508.cpp

#CS508 Assignment 1 IDEA SOL Fall 2020
if (x > 50)
then
x = x * 5;
if (x > 500)
then
x = x - 350;
if (x > 350)
then
x = x - 150;
end if
else
then
x = x + 150;
end else
end if
else
then
x = x - 100;
if (x > 500)
then
x = x - 150;
end if
if (x < 500)
then
x = x + 150;
if (x == 500)
then
x = x + 200;
end if
else
then
x = x + 100;
if (x > 650)
then
x = x - 100;
end if
else if (x < 650)
then
x = x + 100;
end if
else
then
x = x * 5;
end else
end else
end if
else
then
x = x + 50;
end else
end else
end if

CS508 Assignment#01 Solution click on the below link 

CS508_Assignment_1_IDEA_SOL_Fall_2020

CS508 Modern Programming Languages Assignment 1 Solution & Discussion Fall 2020


Solution Idea:

 

if (x > 50)

then

x = x * 5;

if (x > 500)

then

x = x - 350;

if (x > 350)

then

x = x - 150;

end if

else

then

x = x + 150;

end else

end if

else

then

x = x - 100;

if (x > 500)

then

x = x - 150;

end if

if (x < 500)

then

x = x + 150;

if (x == 500)

then

x = x + 200;

end if

else

then

x = x + 100;

if (x > 650)

then

x = x - 100;

end if

else if (x < 650)

then

x = x + 100;

end if

else

then

x = x * 5;

end else

end else

end if

else

then

x = x + 50;

end else

end else

end if

if (x > 50)
then
x = x * 5;
if (x > 500)
then
x = x - 350;
if (x > 350)
then
x = x - 150;
end if
else
then
x = x + 150;
end else
end if
else
then
x = x - 100;
if (x > 500)
then
x = x - 150;
end if
if (x < 500)
then
x = x + 150;
if (x == 500)
then
x = x + 200;
end if
else
then
x = x + 100;
if (x > 650)
then
x = x - 100;
end if
else if (x < 650)
then
x = x + 100;
end if
else
then
x = x * 5;
end else
end else
end if
else
then
x = x + 50;
end else
end else
end if

RSS

Looking For Something? Search Below

Latest Activity

+ M.Tariq Malik replied to + M.Tariq Malik's discussion CS301 Data Structures Assignment No 03 Fall 2020 Solution & Discussion Due Date: 21-01-2021 in the group CS301 Data Structures
13 minutes ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion MCM401 Fundamentals of Public Relations GDB Fall 2020 Solution / Discussion in the group MCM401 Fundamentals of Public Relations
21 minutes ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion MCM401 Fundamentals of Public Relations GDB Fall 2020 Solution / Discussion in the group MCM401 Fundamentals of Public Relations
21 minutes ago
+ M.Tariq Malik liked + M.Tariq Malik's discussion MCM401 Fundamentals of Public Relations GDB Fall 2020 Solution / Discussion
21 minutes ago
+ M.Tariq Malik added a discussion to the group MCM401 Fundamentals of Public Relations
23 minutes ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion CS502 Fundamentals of Algorithms Assignment No 03 Fall 2020 Solution & Discussion Due Date: 25-01-2021 in the group CS502 Fundamentals of Algorithms
29 minutes ago
+ M.Tariq Malik liked + M.Tariq Malik's discussion CS502 Fundamentals of Algorithms Assignment No 03 Fall 2020 Solution & Discussion Due Date: 25-01-2021
29 minutes ago
+ M.Tariq Malik added a discussion to the group CS502 Fundamentals of Algorithms
30 minutes ago
+ M.Tariq Malik replied to + M.Tariq Malik's discussion BIO401 Biostatistics GDB Fall 2020 Solution / Discussion in the group BIO401 Biostatistics
36 minutes ago
+ ! ! ! ! ! ! Insane liked ★彡[ꜱʜʏɴᴀ]彡★'s discussion abhī to jaag ke rāteñ guzārnā hoñgī....
36 minutes ago
+ ! ! ! ! ! ! Insane replied to + ! ! hคຖiค khคຖ ! ! ! +'s discussion 'Ghar Se Hum Ghar Talak Gaye Honge, Apne Hee Aap Tak Gaye Honge',
36 minutes ago
+ ! ! ! ! ! ! Insane liked + ! ! hคຖiค khคຖ ! ! ! +'s discussion 'Ghar Se Hum Ghar Talak Gaye Honge, Apne Hee Aap Tak Gaye Honge',
37 minutes ago

© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service

.