Programming can either be Heaven or Hell depending on how much you know and how much you understand. As a CS student, majority of my course mates are still having hard time in programming. While browsing through their codes, I began to understand that they have no idea about what the program should do so that it would generate the desired output, in other words, they were trying to get the output without trying to understand the statement problem. In programming, one should not rush to the ending, we should first understand the problem statement, then know its inputs, then processes, and last is to find the desired output. I will prove my example, the problem statement is "The sum of x and y is equal to 5. The value of y is 3. Find x. If sum of x and y is equal to 5 then print 'Correct' else print 'Incorrect' ". By using this problem statement, we can assume that the inputs are:
x
y=3
sum=5
And the processes:
To find x
x=sum-y
To check if sum of x and y is equal to 5 and then print 'Correct' else print 'Incorrect':
if(x+y==sum)
print "Correct"
else
print "Incorrect"
Now that we have both the inputs and processes we can use it to write a code on any programming language. My personal favorite is PHP so I will use PHP in writing the code. The code should be:
<?php
$y=3;
$sum=5;
$x=$sum-$y;
if($x+$y==$sum)
echo"Correct";
else
echo"Incorrect";
?>
By using this code I got:
Easy right? Try it yourself. Experiencing starts with trying. Even talent can be overcome by hard work. Good luck :)
Online Casino in Maharashtra: Guide, Bonuses, Registration
ReplyDeleteOnline Casino in Maharashtra | Latest kadangpintar News, Latest Casino 메리트 카지노 | Latest Online Offers, 메리트 카지노 쿠폰 Bonuses, Banking Methods | Payment Without Commission | Deposit Without
BetMGM Casino is now online in Michigan
ReplyDeleteWe 울산광역 출장샵 will be opening the BetMGM Sportsbook in 문경 출장안마 Michigan on 목포 출장샵 September 18. We'll be there for you to test the sportsbook at 동두천 출장안마 the BetMGM 사천 출장안마 kiosks.