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

www.vustudents.ning.com

 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

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)

Views: 936

### 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

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)thenx = x * 5;if (x > 500)thenx = x - 350;if (x > 350)thenx = x - 150;end ifelsethenx = x + 150;end elseend ifelsethenx = x - 100;if (x > 500)thenx = x - 150;end ifif (x < 500)thenx = x + 150;if (x == 500)thenx = x + 200;end ifelsethenx = x + 100;if (x > 650)thenx = x - 100;end ifelse if (x < 650)thenx = x + 100;end ifelsethenx = x * 5;end elseend elseend ifelsethenx = x + 50;end elseend elseend 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

## Latest Activity

20 minutes ago
+ ! ! Pagal Dewani ! ! + posted discussions
44 minutes ago
≋M≋S≋ posted a discussion

### JAB PYAAR NAHIN HAI

2 hours ago
2 hours ago
Asad waqas joined + M.Tariq Malik's group

### PSY403 Social Psychology

2 hours ago
3 hours ago
Mani Siddiqui Ex liked Ammara Sabir's discussion !!!!!!Muhabbat!!!!!!
3 hours ago
Mani Siddiqui Ex posted a status
"میں لامحدود تھا، تم نے محدود کیا اتنا میری ابتدا بھی تم سے، میری انتہا بھی تم تک"
3 hours ago
Amna Bhatti replied to + !! Ήලᵯᵯℹ Ⲥⱨ !! +'s discussion indeed
4 hours ago
Amna Bhatti liked + !! Ήලᵯᵯℹ Ⲥⱨ !! +'s discussion indeed
4 hours ago
4 hours ago
Amna Bhatti liked Shoaib Asghar's discussion CS619 Final Viva
4 hours ago

1

2

3

4

5