Skip to content

Instantly share code, notes, and snippets.

View leoodz's full-sized avatar
⌨️
Focusing

Leo Pham leoodz

⌨️
Focusing
View GitHub Profile
11.times do |i| print i*9 end
10.times { |i| print "9x#{i+1}=#{(i+1)*9}\n" }
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
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ì "
puts "nhập chữ vào đây"
text = gets.chomp
puts text.length < 10 ? "Đ" : "M"
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:"
numbers = ["5", "4", "8"]
numbers.collect { |num| num.to_i}
numbers = ["5", "4", "8"]
numbers.map!(&:to_s)
#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
#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