Bạn chưa đăng nhập. Vui lòng đăng nhập để hỏi bài

Những câu hỏi liên quan
thanh
Xem chi tiết
datcoder
10 tháng 10 2023 lúc 23:48

Bài 6:

#include <bits/stdc++.h>

using namespace std;

int main () {

int n;

cin >> n;

int p=n/60;

int s=n%60;

if (p<60) {

if (p<10) {

if (s<10) cout <<"00:0" << p << ":0" << s; else cout <<"00:0" << p << ":" << s;} else

if ((p>=10) and (p<60)) {if (s<10) cout << "00:" << p << ":0" << s;

else cout << "00:" << p << ":" << s;}}

if (p>=60) {

int h = p/60;

p = p%60;

if (h<10) { if (p<10) {

if (s<10) cout << "0" << h << ":" << "0" << p <<":0" <<s;

else cout << "0" << h << ":" << "0" << p <<":" <<s; } else {

if (s<10) cout << "0" << h << ":" << p <<":0" <<s;

else cout << "0" << h << ":" << p <<":" <<s;} } else {

if (p<10) { if (s<10) cout << h << ":" << "0" << p <<":0" <<s;

else cout << h << ":" << "0" << p <<":" <<s; } else {

if (s<10) cout << h << ":" << p <<":0" <<s;

else cout << h << ":" << p <<":" <<s;} } }

return 0;

}

datcoder
11 tháng 10 2023 lúc 0:05

Bài 5:

#include <bits/stdc++.h>

using namespace std;

int main () {

int n;

cin >> n;

int m=n;

int t100 = n/100;

n = n - t100 * 100;

int t50 = n/50;

n = n - t50*50;

int t20 = n/20;

n = n - t20*20;

int t10 = n/10;

n = n - t10*10;

int t5 = n/5;

n = n - t5*5;

int t2 = n/2;

n = n - t2*2;

int t1 = n;

if (m>=100) cout << t100 << " to menh gia 100" << endl;

if (t50!=0) cout << t50<< " to menh gia 50" << endl;

if (t20!=0) cout << t20<< " to menh gia 20" << endl;

if (t10!=0) cout << t10<< " to menh gia 10" << endl;

if (t5!=0) cout << t5<< " to menh gia 5" << endl;

if (t2!=0) cout << t2<< " to menh gia 2" << endl;

if (t1!=0) cout << t50<< " to menh gia 1" << endl;

return 0;

}

Phan Thị Ka
Xem chi tiết
Minh Lệ
19 tháng 3 2023 lúc 22:40

Câu 1:

Program HOC24;

var i,p: integer;

t: longint;

begin

write('Nhap P: '); readln(p);

t:=0;

for i:=1 to p do if i mod 2<>0 then t:=t+i;

write('Tong cac so le la: ',t);

readln

end.

Minh Lệ
19 tháng 3 2023 lúc 22:41

Câu 2:

Program HOC24;

var i,n: integer;

t: longint;

begin

write('Nhap N: '); readln(n);

t:=0;

for i:=1 to n do if i mod 2=0 then t:=t+i;

write('Tong cac so chan la: ',t);

readln

end.

Minh Lệ
19 tháng 3 2023 lúc 22:42

Câu 3:

Program HOC24;

var i,t,n: integer;

begin

write('Nhap N: '); readln(n);

t:=0;

for i:=1 to n do if n mod i=0 then t:=t+i;

write('Tong cac uoc cua ',n,' la: ',t);

readln

end.

Long ca ca
Xem chi tiết
phuongtra pham
Xem chi tiết
Nguyễn Lê Phước Thịnh
13 tháng 11 2021 lúc 0:08

uses crt;

var a,b:real;

begin

clrscr;

readln(a,b);

writeln(a+b:4:1);

readln;

end.

Nhung
23 tháng 5 2022 lúc 12:03

program b1;

uses crt;

var a,b,s:real;

begin

clrscr;

writeln('Nhap hai so a va b: ');

readln(a,b);

s:=a+b;

write('Tong cua hai so a va b la: ',s:1:1);

readln;

end.

 

P/S: phần lưu lẫn đặt tên người dùng nào cũng đều làm được.
+ Chọn Save as ở phần File phía góc trái trên cùng rồi đặt tên.

Lê thị anh thư
Xem chi tiết
Bé Kunz
Xem chi tiết
Nguyễn Lê Phước Thịnh
21 tháng 3 2021 lúc 22:24

Bài 1: 

uses crt;

var a:array[1..200]of integer;

i,n,t:integer;

begin

clrscr;

write('Nhap n='); readln(n);

for i:=1 to n do 

begin

write('A[',i,']='); readln(a[i]);

end;

t:=0;

for i:=1 to n do 

  if a[i] mod 5=0 then t:=t+a[i];

writeln('Tong cac so chia het cho 5 la: ',t);

readln;

end.

Nguyễn Lê Phước Thịnh
21 tháng 3 2021 lúc 22:25

Bài 2: 

uses crt;

var st:string;

d,i:integer;

begin

clrscr;

write('Nhap xau:'); readln(st);

d:=length(st);

for i:=1 to d do 

  if st[i]=#32 then delete(st,i,1);

writeln(st);

readln;

end.

scar titan
28 tháng 7 2021 lúc 10:11

python có ko bạn

 

Divine 000
Xem chi tiết
Nguyễn Lê Phước Thịnh
21 tháng 2 2021 lúc 13:50

Câu 1: 

uses crt;

var a:array[1..100]of integer;

i,n,t:integer;

begin

clrscr;

write('Nhap n='); readln(n);

for i:=1 to n do 

begin

write('A[',i,']='); readln(a[i]);

end;

t:=0;

for i:=1 to n do 

  t:=t+a[i];

writeln('Tong cac so trong mang la: ',t);

readln;

end.

Câu 2: 

uses crt;

var a:array[1..100]of integer;

i,n,t:integer;

begin

clrscr;

write('Nhap n='); readln(n);

for i:=1 to n do 

begin

write('A[',i,']='); readln(a[i]);

end;

t:=0;

for i:=1 to n do 

  if a[i] mod 2=0 then t:=t+a[i];

writeln('Tong cac so chan la: ',t);

readln;

end.

NGUYỄN VIẾT LUẬN
Xem chi tiết
Trần Long
Xem chi tiết
Xyz OLM
7 tháng 2 2023 lúc 12:03