-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
67 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,76 @@ | ||
snippet if | ||
if ( $1 ) { | ||
$2 | ||
} | ||
endsnippet | ||
if ( $1 ) { | ||
$2 | ||
} | ||
|
||
snippet for | ||
for (int ${1:i} = 0; $1 < ${2:n}; $1++) { | ||
$0 | ||
} | ||
endsnippet | ||
for (int ${1:i} = 0; $1 < ${2:n}; $1++) { | ||
$0 | ||
} | ||
|
||
snippet do | ||
do { | ||
1; | ||
} while ($2); | ||
endsnippet | ||
do { | ||
1; | ||
} while ($2); | ||
|
||
snippet while | ||
while ($1) { | ||
$2; | ||
} | ||
endsnippet | ||
while ($1) { | ||
$2; | ||
} | ||
|
||
snippet main | ||
#include <iostream> | ||
using namespace std; | ||
using namespace std; | ||
|
||
int main() { | ||
return 0; | ||
} | ||
endsnippet | ||
int main() { | ||
return 0; | ||
} | ||
|
||
snippet kiemTraSoNguyenTo | ||
bool kiemTraSoNguyenTo(int number) { | ||
bool flag = false; | ||
int count = 0; | ||
bool kiemTraSoNguyenTo(int number) { | ||
bool flag = false; | ||
int count = 0; | ||
|
||
if (number < 2 || number > 100) { | ||
flag = false; | ||
} else { | ||
for (int i = 2; i <= number / 2; i++) { | ||
if (number % i == 0) { | ||
count++; | ||
if (number < 2 || number > 100) { | ||
flag = false; | ||
} else { | ||
for (int i = 2; i <= number / 2; i++) { | ||
if (number % i == 0) { | ||
count++; | ||
} | ||
} | ||
if (count == 0) { | ||
flag = true; | ||
} | ||
} | ||
return flag; | ||
} | ||
if (count == 0) { | ||
flag = true; | ||
} | ||
} | ||
return flag; | ||
} | ||
endsnippet | ||
|
||
snippet nhapSoNguyenDuong | ||
int nhapSoNguyenDuong(int &n) { | ||
do { | ||
cin >> n; | ||
} while (n <= 0); | ||
int nhapSoNguyenDuong(int &n) { | ||
do { | ||
cin >> n; | ||
} while (n <= 0); | ||
|
||
return n; | ||
} | ||
endsnippet | ||
return n; | ||
} | ||
|
||
snippet kiemTraSoHoangThien | ||
bool kiemTraSoHoangThien(int number) { | ||
int sum = 0; | ||
int flag = false; | ||
bool kiemTraSoHoangThien(int number) { | ||
int sum = 0; | ||
int flag = false; | ||
|
||
for (int i = 1; i < number; i++) { | ||
if (number % i == 0) { | ||
sum += i; | ||
} | ||
} | ||
for (int i = 1; i < number; i++) { | ||
if (number % i == 0) { | ||
sum += i; | ||
} | ||
} | ||
|
||
if (sum == number) { | ||
flag = true; | ||
} else { | ||
flag = false; | ||
} | ||
if (sum == number) { | ||
flag = true; | ||
} else { | ||
flag = false; | ||
} | ||
|
||
return flag; | ||
} | ||
endsnippet | ||
return flag; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
snippet NhapMang | ||
public static void NhapMang(int[] array, int number) { | ||
for (int i = 0; i < number; i++) { | ||
Console.Write("Nháºp phần tá» thứ " + (i + 1) + ": "); | ||
array[i] = Convert.ToInt32(Console.ReadLine()); | ||
} | ||
} | ||
endsnippet | ||
public static void NhapMang(int[] array, int number) { | ||
for (int i = 0; i < number; i++) { | ||
Console.Write("Nháºp phần tá» thứ " + (i + 1) + ": "); | ||
array[i] = Convert.ToInt32(Console.ReadLine()); | ||
} | ||
} | ||
|
||
snippet XuatMang | ||
public static void XuatMang(int[] array, int number) { | ||
for (int i = 0; i < number; i++) { | ||
Console.Write(array[i] + "\t"); | ||
} | ||
} | ||
endsnippet | ||
public static void XuatMang(int[] array, int number) { | ||
for (int i = 0; i < number; i++) { | ||
Console.Write(array[i] + "\t"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
snippet cl | ||
console.log( $1 ); | ||
endsnippet | ||
console.log( $1 ); | ||
|
||
snippet for | ||
for (let i = 0; $1 ; i++) { | ||
$2 | ||
} | ||
endsnippet | ||
for (let i = 0; $1 ; i++) { | ||
$2 | ||
} |