Hang Phannat (TP3)
Hang Phannat (TP3)
ID: e20230626
Problem1- Write a C program to get a number from a user. The program tells us whether this
INPUT:
OUTPUT:
Code
Result:
Problem2- Write a C program to get a number from a user. The program tells us whether this
input number is either one of the following categories below: A) negative and odd numbers, B)
negative and even numbers, C) positive and odd numbers, and D) positive and even numbers.
INPUT:
Enter a number: 50
OUTPUT: It is in the category D because it is a positive number and it is also an even number.
Code
Result
Problem3- Write a C program to ask a user for 7 numbers (7 variables). Find the minimum
INPUT:
OUTPUT:
Code:
Result :
Ask a user to input the coefficients a, b and c. The program calculates delta and find roots of the
INPUT:
Input a: 1
Input b: 4
Input c: 3
OUTPUT:
Remark: Make sure you verify the result from the program whether it is correct if we do it
manually by hand .
code:
Result:
Problem6- Write a C program to tell how much tax a person should pay based on his/her salary
and gender. The program ask a user for gender, name, and salary (US dollar). The tax is
-pay tax 10%, for male and his salary is more than 400 USD.
-pay tax 5%, for male and his salary is from 200 USD to 400 USD.
-pay tax 5%, for females and her salary is more than 500 USD.
-pay tax 3%, for females and her salary is from 250 USD to 500 USD.
INPUT:
Enter gender: F
Output:
Code:
Result:
Problem7- Write a C program to compute the average score of a student over 3 subjects Math,
English and Computer. Then tell which grade this student could get. The grading is based on
86 - 100 A
81 - 85 B
70 - 80 C
61 - 69 D
50 - 60 E
Below 50 F
INPUT:
English score: 90
Output: