Question







→ What are the decisions you have to make when programming computer?
0 0
Add a comment Improve this question Transcribed image text
Answer #1

We need to make some decisions when we programming a computer. For example, if a condition X satisfy then Y execute
otherwise Z execute.

if x then
Y
else
Z

Suppose, we want to find out maximum of two numbers A and B. Now, we need to make decision that if A is greater than B, then A is a maximum number, otherwise B is maximum.

if A > B then
A is maximum
else
B is maximum

There may have more than one decisions, then we combine these decisions using AND or OR operators.
Suppose, we want to find out letter grade of a student from average grade. We can use following decisions:

if average>=90 AND average<=100 then
grade = A
else if average>=80 then
grade = B
else if average>=70 then
grade = C
else if average>=60 then
grade = D
else
grade = F

When average grade greater or equal to 90 and less than or equal to 100 then letter grade is A. So on..
Therefore we need to make decisions for which condition the letter grade have achieved.

In C/C++/Java programming languages some decision making statements available:
Simple if statement
if-else-if statement (ladder if)
nested if statement
switch statement

Add a comment
Know the answer?
Add Answer to:
→ What are the decisions you have to make when programming computer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
Active Questions
ADVERTISEMENT