Sunday, September 14, 2014

[Delivery] More conditional

Bài 1: Declare two variables x and y. Assign values to these variables. Number x should be printed only if it is less than 2000 or greater than 3000, and number y should be printed only if it is between 100 and 500.





Flow Chart:
Flow Chart



My Code

Final result:






Bài 2: Write a program to show your computer’s capabilities. The user types in a letter of the alphabet and your program should display the corresponding language or package available. Some sample input ans output is given below :




                           Input                                  Output

                           A or a                                Ada
                           B or b                                 Basic
                           C or c                                 COBOL
                           D or d                                dBASE III
                           f or F                                  Fortran
                           p or P                                 Pascal
                           v or V                                Visual C++

Flow Chart: 



My Code + result


Ở đây chú ý đặt biến char alphabet và dùng cấu trúc switch để với expressionalphabet




Bài 3: Accept values in three variables and print the highest value.


Flow Chart:



My Code + result 


Bài học rút ra: 


  • Cấu trúc switch 


No comments:

Post a Comment