This file contains hidden or 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
11.times do |i| print i*9 end |
This file contains hidden or 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
10.times { |i| print "9x#{i+1}=#{(i+1)*9}\n" } |
This file contains hidden or 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
puts "nhập tham số a" | |
a = gets.chomp | |
a = a.to_f | |
puts "nhập tham số b" | |
b = gets.chomp | |
b = b.to_f | |
puts "nhập tham số c" | |
c = gets.chomp | |
c = c.to_f | |
if a == 0 |
This file contains hidden or 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
movies = { | |
StarWars: 4.8, | |
Divergent: 4.7, | |
LionKing: 3.8 | |
} | |
puts "Nhập add để thêm phim và đánh giá " | |
puts "Nhập update để chỉnh sửa lại phim bạn đã thêm " | |
puts "Nhập display để hiện những phim bạn đã đánh giá " | |
puts "Bạn muốn làm gì " |
This file contains hidden or 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
puts "nhập chữ vào đây" | |
text = gets.chomp | |
puts text.length < 10 ? "Đ" : "M" |
This file contains hidden or 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
array = [1,2, 6 ,4, 2, "ĐM Mèo", 5599, "chim cu cu"] | |
print "chọn 1 để in ra số chẵn,2 để in ra strings:" | |
choice = gets.chomp | |
case choice | |
when "1" | |
puts array.select { |item| item.is_a?(Integer) && item.even? } | |
when "2" | |
puts array.select { |item| item.is_a?(String) } | |
else | |
puts "Chọn 1 hoặc 2 thôi :mad:" |
This file contains hidden or 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
numbers = ["5", "4", "8"] | |
numbers.collect { |num| num.to_i} |
This file contains hidden or 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
numbers = ["5", "4", "8"] | |
numbers.map!(&:to_s) |
This file contains hidden or 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
#include <stdio.h> | |
#include <stdlib.h> | |
#define BOOL short int | |
#define TRUE 1 | |
#define FALSE 0 | |
#define NUMBER_OF_ROWS 3 | |
#define NUMBER_OF_COLUMNS 3 |
This file contains hidden or 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
#include <stdio.h> | |
int main() | |
{ | |
int n, i; | |
int giaithua = 1; | |
printf("nhap 1 so nguyen: "); | |
scanf("%d",&n); | |
if (n < 0) | |
printf("ko co giai thua cua so am."); | |
else |
OlderNewer