C/c++

Advertisement


Question
Create a flowchart that will determine the factor of a number entered by the user. Display the number and its factorial value. Create a code afterwards.

I already did the flowchart but I am not sure whether I should use the switch-case or the if-else for coding it.

Thanks very much :D

I re

Answer
Hello Veronica, create your code with if-else. Then show me the code. If it can be converted to switch-case, I'll show you the switch-case version. Then you can use which ever version you want.

The switch-case can be used if you want to check one variable for many constant values. A switch-case can always be written as if-else, but if-else cannot always be written as switch-case. The if-else is more flexible.

Best regards
Zlatko

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Zlatko

Expertise

No longer taking questions.

Experience

No longer taking questions.

Education/Credentials
No longer taking questions.

©2012 About.com, a part of The New York Times Company. All rights reserved.