December 17, 2018
Day month Year
Threads: Write a program that reads from the keyboard 3 perform integer day, month, and output to the screen in the form of "dd / mm / yyyy".
Input: A line of 3 integers separated by a space.
Output: A string in the format date: dd/mm/yyyy
For example:
input: 5 6 2018 output: 05/06/2018
You are not logged in? Log in to Submit Now!
22 Comments
Add a Comment
You must be logged in to post a comment.
Console.WriteLine(DateTime.Parse(date).ToString(“dd/MM/yyyy”));
1. Accepted
2. Wrong Answer
Test Input:
8 12 1992
Test Output:
08/12/1992
Your Output:
12/08/1992
3. Accepted
Sao câu 2 lại sai đc ad =.=
Bạn nhìn Test output khác với your output kìa.
str=”09 12 1992″
print(str.replace(” “, “/”))
tai sao lại sai
Bạn xem sự khác biệt của Test ouput và Your output nhé.
30/2/2018 đc k a
Là sao bạn?
month 2 làm gì có ngày 30, day 29 là hết nấc rồi đó.
Mình nghĩ cái này theo chuỗi định dạng chứ k cần vậy…
#include
int main()
{int a,b,c;
printf(“input:\n”);
scanf(“%d%d%d”,&a,&b,&c);
printf(“output:\n%02d/%02d/%04d”,a,b,c);
return 0;
}
e sai o dau a. ?
Bạn so sánh your output và test output nhé.
scanf(“%02d %02d %04d”, &a, &b, &c); your dentist
em code bằng c++ nhưng xài if else, k biết mọi người có cách nào nhanh hơn k ạ ?
honey, họ biểu mình in ra màn hình tận 3 cái luôn à anh, nhưng ví dụ có 1 cái thôi mà
Là sao nhỉ?
Ai viet bai nay bang pascal giup minh voi
Test Input:
12 12 2018
Test Output:
12/12/2018
Your Output:
12/12/2018
Trong python có cách nào xóa khoảng trắng đi không ạ ? Kết quả mình làm nó ra 05 / 06 / 2018 mà trong khi đáp án là 05/06/2018.
i = input()
sa, sb, sc = i.split(‘ ‘)
a = int(sa)
b = int(sb)
c = int(sc)
print(“%.2d”%a,’/’,”%.2d”%b,”/”,”%.4d”%c)
thầy cho em hỏi bài này em code như sau :
#include
int main(){
int h = 0 , m = 0 , s=0, i = 60 ;
h<=24 , m <=60 ;
scanf("%d",&s);
if (s<i||m= i||m >= i,m = s/60,h=m/i);
printf(“%02d:%02d:%02d”,h,m=m%i,s=s%i);
return 0;
}
pass hết 8 bài test nhưng em muốn sau thời điểm 23:59:59 quay về 00:00:00 thì làm cách nào ạ ?
bạn chia lấy dư số giờ cho 24 là được.
Bài này trong pascal phải dùng lệnh If then đúng không bạn?
Đúng rồi.
ai viet bai nay bang pascal giup minh voi