- các dạng toán bài 1:: trích từ 20 bộ đề practical. anh em xem có cái nào phải sửa không nhé, chỗ nào không hiểu cứ chém nhịêt tình.
1.1 Find and return max and min of N real numbers
- tìm và trả về giá trị lớn nhất, nhỏ nhất của N số thực
- Code:
-
void find(float a[],int n, float *max,float *min);
1.2 Find and return the largest string of N strings
- tìm và trả về chuỗi dài nhất của N chuỗi
- Code:
-
void finds(char str[][100], int n, char *s);
1.3 Check whether an integer is prime or not
- kiểm tra một số nguyên có phải là số nguyên tố hay không
- Code:
-
int checkprime(int n);
// trả về 1 khi đúng và 0 khi không phải
1.4 Function for printing N float numbers
- viết hàm in ra N số thực
- Code:
-
void inf(float a[], int n);
2.1 Input array A have two dimension N and M and array store real numbers
- Nhập 1 mảng 2 chiều NxM lưu các số thực
- Code:
-
void inputf(float a[][100], int n, int m);
2.2 calculate total value of N real number
- Tính tổng giá trị N số thực
- Code:
-
float sumf(float a[], int n);
2.3 Check whether an integer is even or odd
- Kiểm tra một số nguyên là chẵn hay lẻ
int checkeven(int n); // trả về 1 nếu chẵn, 0 nếu lẻ
2.4 Swap value of two integer numbers
- Hoán đổi giá trị hai số nguyên
- Code:
-
void swap(int *a, int *b);
3.1 check whether an integer is a prime or not
- kiểm tra một số nguyên là số nguyên tố hay không
- Code:
-
int checkprime(int n);
// trả về 1 nếu là số nguyên tố và 0 nếu không phải
3.2 Calculate and return area of a retangle
- tính và trả về diện tích một hình chữ nhật
- Code:
-
float s(float a, float b);
3.3 Find the sum of odd number between two integer numbers
- Tìm tổng các số lẻ nằm giữa hai số nguyên
- Code:
-
int sumodd(int a, int b);
3.4 Find the minimum and the maximum value in an array
- tìm giá trị nhỏ nhất, lớn nhất trong mảng
- Code:
-
void find(int a[], int *max, int *min);
// mặc định không cho kiểu dữ liệu thì lấy là kiểu int
4.1 Find and return max of N double numbers
- Tìm và trả về giá trị lớn nhất của N số double
- Code:
-
double maxd(double a[], int n);
4.2 Find and return the minimum string of N strings
- Tìm và trả về chuỗi ngắn nhất trong N chuỗi
- Code:
-
void finds(char str[][100], int n, char *s);
// s lưu chuỗi ngắn nhất tìm được
4.3 check whether an integer is prime or not
- Kiểm tra một số nguyên là số nguyên tố hay không
- Code:
-
int check(int n);
// return 1 if true else return 0
4.4 Function for printing N float numbers
- Viết hàm in ra N số thực
- Code:
-
void inf(float a[], int n);
5.1 Input array A have wo demision N and M and array store real number
- Nhập một mảng hai chiều A[n][m] lưu trữ các số thực
- Code:
-
void inputf(float a[][100], int n, int m);
5.2 Calculate total value of N real numbers
- tính tổng giá trị của N số thực
- Code:
-
float sumf(float a[], int n);
5.3 Check whether an integer is even or odd
- kiểm tra một số nguyên là chẵn hay lẻ
- Code:
-
int check(int n);
5.4 Swap value of two integer numbers
- Hoán đổi giá trị hai số nguyên
- Code:
-
void swap(int *a, int *b);
6.1 Find and return min of N real numbers
- Tìm và trả về giá trị nhỏ nhất trong N số thực
- Code:
-
float min(float a[], int n);
6.2 Find and return the number of character 'ch' in string
- tìm và trả về số lần xuất hiện của ký tự 'ch' trong chuỗi
- Code:
-
int findch(char a[], char ch);
6.3 Check whether an integer is odd or not
- Kiểm tra xem một số nguyên là số lẻ hay không
- Code:
-
int checkodd(int n);
6.4 function for printing N double numbers
- Viết hàm in ra N số double
- Code:
-
void indd(double a[], int n);
7.1 Input array A have two demision N and M and array A store real number
- nhập mảng hai chiều a[n][m] lưu các số thực
- Code:
-
void input(float a[][100], int n, int m);
7.2 Calculate total value of N real numbers
- tình tổng giá trị N số thực
- Code:
-
float sum(float a[], int n);
7.3 Check whether an integer is even or odd
- kiểm tra một số nguyên là chẵn hay lẻ
- Code:
-
int check(int n);
7.4 swap value of two integer numbers
- hoán vị hai số nguyên
- Code:
-
void swap(int *a, int *b);
8.1 check whether an integer is a prime number or not
- kiểm tra một số nguyên là số nguyên tố hay không
- Code:
-
int check(int n);
8.2 Calculate and return area of retangle
- tính và trả về diện tích hình chữ nhật
- Code:
-
float s(float a, float b);
8.3 Find the sum of odd number between two integer numbers
- tìm tổng các số lẻ giữa hai số nguyên
- Code:
-
int sum(int a, int b);
8.4 Find the min and the max value in an array
- tìm giá trị min, max trong một mảng
- Code:
-
void find(int a[], int *min, int *max);
9.1 Input array A have two demision N and M and array A store real number
- nhập một mảng 2 chiều a[n][m] lưu các số thực
- Code:
-
void input(float a[][100], int n, int m);
9.2 calculate total value of N real numbers
- tính tổng giá trị N số thực
- Code:
-
float sum(float a[], int n);
9.3 Check whether an integer is even or odd
- kiểm tra một số nguyên là chẵn hay lẻ
- Code:
-
int check(int n);
9.4 Swap of two integer numbers
- hoán vị hai số nguyên
- Code:
-
void swap(int *a, int *b);
10.1 Find max value of N integer numbers
- tìm giá trị lớn nhất trong N số nguyên
- Code:
-
int find(int a[], int n);
10.2 Display all prime number of N integer number
- hiển thị tất cả các số nguyên tố trong n số nguyên
- Code:
-
void display(int a[], int n);
10.3 Check whether an integer is even or not
- kiểm tra một số nguyên là chẵn hay không
- Code:
-
int check(int n);
10.4 Cut all space at the first of string
- cắt tất cả các khoảng trắng ở đầu chuỗi
- Code:
-
void cuts(char a[]);
11.1 Input the two demision array 4x4 the integer numbers and display all
element under maxtrix format
- nhập mảng hai chiều 4x4 lưu các số nguyên và hiển thị tất cả các phần tử dưới dạng ma trận
- Code:
-
void input(int a[][4]);
11.2 Count the number of capital character in the string
- đếm số ký tự hoa trong chuỗi
- Code:
-
int count(char *s);
11.3 Return the size (in bytes) of the integer variable
- trả về kích thước bằng byte của một biến nguyên
- Code:
-
int size(int x);
11.4 Input year and check if it is the leap year
- nhập vào một năm và kiểm tra xem có phải là năm nhuận hay không
- Code:
-
int checkleap(int a);
12.1 Calculate the average of N float numbers
- tính trung bình của N số thực
- Code:
-
float aver(float a[], int n);
12.2 Find and return least common multiple of two integer numbers a,b
- tìm và trả về bội số chung nhỏ nhất của 2 số a,b
- Code:
-
int find(int a, int b);
12.3 Convert a integer number from decimal to hex
- chuyển một số nguyên từ hệ 10 sang hệ 16
- Code:
-
void convert(int x, char *s);
12.4 Print one string
- viết hàm in ra một chuỗi
- Code:
-
void ins(char *s);
13.1 Calculate the sum of N integer numbers
- tính tổng N số nguyên
- Code:
-
int sum(int a[], int n);
13.2 Check integer x have existing in the array of N integer numbers
- kiểm tra xem X có tồn tại trong mảng N số nguyên hay không
- Code:
-
int checkX(int a[], int n, int X);
13.3 Check three integers to be three sides of a triangle
-kiểm tra 3 số nguyên có phải là các cạnh của một tam giác hay không
- Code:
-
int check(int a, int b, int c);
13.4 To mix two arrays integer by descending
- trộn hai mảng số nguyên theo thứ tự giảm dần
- Code:
-
void mix(int a[], int b[], int m, int n, int *c);
14.1 Find and return greast common divisor two integers number a,b
- tìm và trả về ước số chung lớn nhất của 2 số nguyên
- Code:
-
int find(int a, int b);
14.2 Find and return the position of min in array of N float numbers
- tìm và trả về vị trí của giá trị nhỏ nhất trong N số thực
- Code:
-
int pos(float a[], int n);
14.3 Input a integer number by reference
- nhập một số nguyên bằng cách tham chiếu
- Code:
-
void input(int *n);
14.4 Count the times appearance of each character appear in the string
- đếm số lần xuất hiện của mỗi ký tự xuất hiện trong chuỗi
- Code:
-
void count(char *s);
15.1 Check an integer number to be a Fibonacci number
- kiểm tra một số nguyên có phải là số Fibonacci hay không
- Code:
-
int check(int n);
15.2 Calculate the average of one integer matrix two demision NxN
- Tính trung bình của một ma trận số nguyên 2 chiều NxN
- Code:
-
float aver(int a[][100], int n);
15.3 Convert one decimal number to binary number represented by one integer array
- Chuyển một số thập phân sang nhị phân, biểu diễn bằng một mảng số nguyên
- Code:
-
void convert(int n,int a[]);
15.4 Calculate the sum of two float numbers
- tính tổng 2 số thực
- Code:
-
float sum(float a, float b);
16.1 Find the max lenght of N strings
- tìm độ dài lớn nhất của N chuỗi
- Code:
-
int maxlen(char str[][100], int n);
16.2 Find max and count number of max N integer element. return count, max is parameter
- tìm max và đếm số giá trị max trong N phần tử số nguyên, trả về số đếm, max là một tham số
- Code:
-
int countmax(int a[], int n, int *max);
16.3 input integer N and check is in 1...100. if ok return 1 else return 0
- Nhập số nguyên N và kiểm tra xem nó có nằm trong khoảng từ 1->100
đúng thì trả về 1 , sai thì trả về 0
- Code:
-
int check(int n);
16.4 calculate factorial of N
- tính giai thừa của N
- Code:
-
long fac(int n);
17.1 find common divisor of three integer numbers
- tìm ước số chung của 3 số nguyên
- Code:
-
void find(int a, int b, int c,int *a);
17.2 Find and return the min of N integer numbers
- tìm và trả về giá trị nhỏ nhất của N số nguyên
- Code:
-
int findmin(int a[], int n);
17.3 Check whether an integer is odd of even
- kiểm tra một số nguyên là chẵn hay lẻ
- Code:
-
int check(int n);
17.4 Function for printing N float numbers
- viết hàm để in ra N số thực
- Code:
-
void inf(float a[], int n);
18.1 Find and return max of three integer numbers
- tìm và trả về giá trị lớn nhất của 3 số nguyên
- Code:
-
int max(int a, int b, int c);
18.2 input integer N and array N integer element
- nhập số nguyên N và mảng N số nguyên
- Code:
-
void input(int *n, int a[]);
18.3 Input integer N and check N is prime or not
- nhập số nguyên N và kiểm tra xem N có phải là số nguyên tố hay không
- Code:
-
int check(int *n);
18.4 Find the largest strings have lenght equal max of N strings
- tìm các chuỗi dài nhất có chiều dài bằng chiều dài lớn nhất trong N chuỗi
- Code:
-
void finds(char str[][100], int n, char s[][100]);
// s lưu các chuỗi có độ dài = max
19.1 Find and return min of three integer numbers
- tìm và trả về giá trị nhỏ nhất của 3 số nguyên
- Code:
-
int find(int a, int b, int c);
19.2 Print array N integer element
- hàm in mảng N số nguyên
- Code:
-
void prin(int a[], int n);
19.3 Input integer N and check N is odd or even
- nhập số nguyên N và kiểm tra xem N là số lẻ hay chẵn
- Code:
-
int inputcheck(int *n);
// lẻ :1..chẵn: 0
19.4 find the smallest strings have length equal min length of N strings
- tìm các chuỗi ngắn nhất có chiều dài bằng chiều dài min của N chuỗi
- Code:
-
void find(char str[][100], int n, char s[][100]);
20.1 Print one string with is parameter
- in một chuỗi dưới dạng tham số
- Code:
-
void ins(char *s);
20.2 Find min and count number of min of N integer element. return min, count is paratemer
- tìm giá trị nhỏ nhất và đếm xem có bao nhiêu giá trị min trong N số nguyên tố
trả về giá trị min, đếm như là một tham số
- Code:
-
int countmin(int a[], int, n, int *count);
20.3 Input integer N and check N is positive or negative
-nhập số nguyên N và kiểm tra xem n là dương hay âm
- Code:
-
int input(int *n);
// 1: nếu n>0, 0: nếu n<0
20.4 Calculate factorial of n
- tính giai thừa của N
- Code:
-
long fac(int n);