www.vustudents.ning.com

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

# 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

Views: 1084

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

1

2

3

## Latest Activity

10 hours ago
15 hours ago
Hamza( Graphic Designer) and Mehreen Tasneem are now friends
15 hours ago
Minahil khalid left a comment for ☞De Veloper☜♨
17 hours ago
Aijaz khan updated their profile
21 hours ago
Aijaz khan joined + M.Tariq Malik's group

### CS202 Fundamentals of Front End Development

21 hours ago
Ribqa, Muhammad Rizwan Ansari, Muhammad Imran and 3 more joined Virtual University of Pakistan
21 hours ago
21 hours ago