Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

HOMEWORK: 01/02/2023

NAME: PHẠM ĐỨC MINH


CLASS: 20MC
Link download: sovainoiii/buoi1 (github.com)
EXERCISE 1: Write a program with the following requirements:
 Enter two integer numbers a and b; one operator (+-*/) from the keyboard.
 Print the result of the expression: a (+-*/) b
- Explain the program + code:
+ Khai báo biến a, b, pheptinh
+ Nhập từ bàn phím và kiểm tra nếu nhập không đúng định dạng là số thì sẽ
nhập lại
+ Nhập từ bàn phím phép tính ( +-*/ ) nếu không đúng sẽ thông báo không
đúng định dạng.

- Pictures of the running programs (test):


EXERCISE 2: Write a program to find Roots of Quadratic Equation: ax2 + bx +c = 0
- Explain the program + code:
- Pictures of the running programs (test):
EXERCISE 3: Prime Number Program in C#, we will take an input n from the user; the
program will ask the user to reenter n if n>2 and check whether the number is prime
or not.
- Explain the program + code:

- Pictures of the running programs (test):


EXCERCISE 4: Write a program to create A Number Guessing Game with the
following requirements:
 The program begins by randomly generating a number between 1 and 100.
 The Game prompts a user to input a number.
 The random number is the winning number used to compare against the user’s
guessing number.
 The Game will give a user 7 chances for the user to guess a randomly generated.
number.
 If the user guesses wrong, the program will announce the number guessed is
smaller or bigger than the winning number.

- Explain the program + code:


- Pictures of the running programs (test):

You might also like