Skip to content

Latest commit

 

History

History
129 lines (70 loc) · 6.4 KB

README.md

File metadata and controls

129 lines (70 loc) · 6.4 KB

PE-PRF192

PE1

  1. Find maximum "even" number among five numbers.
  2. Enter n [n is also the first element in array]. Print out all even number at even position and sorted increasing.
  3. Enter h [h is the height of pyramid (h < 20)]. Print out half of the empty pyramid.
  4. Remove all duplicated odd numbers (keeps only the first occurrence of the numbers).
  5. Sorts the characters in each word in the string. Finally, normalize and prints out the word-sorted string.
  6. Enter n [n is the number of characters entered by user]. Sorts then display these characters. Each element prints on one line.
  7. Enter integer number 'a'. Check if 'a' is a power of 3 or not. If it is, prints the exponent that make 'a' is the power of 3. Else, prints out "{a} is not a power of 3".
  8. Display the number of characters in the first three words of string.
  9. Enter integer number 'n'. If 'n' is a prime number, then prints out binary number representation of 'n'. If it isn't, prints "{n} is not a prime number".

PE2

image

PE2020

image

PE3

Câu 1: Tính tổng các ước số của số nguyên dương N

Câu 2: Tính S(x, n) = x – x^2 + x^3 - … + (-1)^n+1 * x^n

Câu 3: Viết chương trình tìm số nguyên dương m lớn nhất sao cho 1 + 2 + … + m < N

Câu 4: Viết chương trình in ra hình chữ nhật có kích thước m x n a. Hình chữ nhật đặc b. Hình chữ nhật rỗng

Câu 5: Tìm số nguyên tố đầu tiên trong mảng 1 chiều các số nguyên. Nếu mảng không có số nguyên tố thì trả về – 1

Câu 6: Kiểm tra mảng có tăng dần hay không nếu không thì in ra -1

Câu 7: Xóa tất cả các phần tử trùng nhau trong mảng và chỉ giữ lại duy nhất 1 phần tử.

Câu 8: Giả sử độ dài chuỗi chia hết cho 3. Thêm ‘-‘ sau mỗi 3 kí tự Vd: 123abcprf -> 123-abc-prf

Câu 9: Xác định chuỗi đối xứng.

Câu 10: Đếm trong chuỗi xem có bao nhiêu kí tự số.

Câu 11: Cắt hết dấu cách thừa trong chuỗi

PE SP2021

Ex1:The program allows user to enter an integer: 'x' using the keyboard (STDIN). If 'x' is an odd number, it prints out: "x is an odd number"; Else, it prints out: "x is not an odd number", where 'x' is the entered number.

Ex2:Users are required to enter an integer number 'n' (2 <n<12) using the keyboard (STDIN). The program needs to find the factorial:(n-1)!. The program then displays this number on screen.

Ex3:Your program allows users to enter an integer number 'n'. If 'n' is a palindrome number, the program prints out: "n is a palindrome number"else, the program prints out: "n is not a palindrome number". Here, 'n' is the entered number.

Ex4:Your program allows users to enter a string 'o' (with maximum length of 100 characters). The system prints out the string with all uppercase letters.

Ex5:Your program allows users to enter a string 's' (length of 's' < 100 characters). The program prints the reversed string in the proper form (capitalizing the first character of each word

Ex6:Your program allows users to enter an integer number 'n'. Then it reads 'n' integer numbers from users. The program sorts the last 'n' entered numbers then prints the odd numbers in descending order. There is a newline character n' between any two printed numbers.

Ex7:Your program should print out a right triangle pattern of prime numbers with height of 'n' rows entered by user. Between any two adjacent numbers, there is a space character.

Ex8:Your program allows users to enter array of 'n' integers, where 'n' is entered by the user (n<10). The program prints the triple of each entered even number following the order that they were entered. There is a newline character in' between any two printed numbers.

Ex9:Your program allows a user to enter array of 'n' integers, where 'n' is entered by the user (n<10). The program prints the odd numbers at the odd positions in descending order. The first row (where 'n' is entered) has position = 0. There is a newline character 'n' betw any two printed numbers.

Ex10:Your program allows users to enter a string 'o' with maximum length of 50 characters. The system prints out just the characters (excluding digits) and their frequencies appearing in the string, following the chronological order (appeared first in the given string). There is an underscore character between a character and its frequency. There is a space character between any adjacent group of character frequency.

PRF292_PE_Trial.docx

Q1

image

image

Q2

image

Q3

image

image

Q4

image

Q5

image

image

Q6

image

Q7

image

image

Q8

image

Q9

image

image

Q10

image