Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
Var a:array[1..1000] of integer;
i,n,d:integer;
sd,s:longint;
Begin
Write('n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap phan tu thu ',i,' = ');readln(a[i]);
s:=s+a[i];
End;
For i:=1 to n do
If a[i] > 0 then
Begin
d:=d+1;
sd:=sd+a[i];
End;
Writeln('Tong cac so vua nhap la ',s);
Write('Co ',d,' so nguyen duong va tong cua chung la ',sd);
Readln
End.
Tham khảo:
uses crt;
Var a,b,i : Integer ;
Begin
Clrscr ;
Write ('Nhap a: '); readln (a);
Write ('Nhap b: '); readln (b);
i:=a + b;
If i mod 2 = 0 then writeln ('Tong hai so ',a,' va ',b,' la ',i,', day la mot so chan')
Else writeln ('Tong hai so ',a,' va ',b,' la ',i,', day la mot so le');
Readln ;
End.
#include <bits/stdc++.h>
using namespace std;
long long a,b,t;
int main()
{
cin>>a>>b;
t=a+b;
if (t>0) cout<<"Tong la so duong";
else if (t<0) cout<<"Tong la so am";
else cout<<"Tong la so 0";
cout<<endl;
if (t%2==0) cout<<"Tong co chia het cho 2";
else cout<<"Tong khong chia het cho 2";
return 0;
}
uses crt;var n: longint; chrn: string; valn,sum,max,i,preperror: byte;begin write('Nhap so can kiem tra: '); readln(n); str(n,chrn); for i:=1 to length(chrn) do begin val(chrn[i],valn,preperror); sum:=sum+valn; if max<valn then max:=valn; valn:=0 end; writeln('Ket qua: '); writeln(length(chrn)); writeln(sum); write(max); readln;end.uses crt;var n: longint; chrn: string; valn,sum,max,i,preperror: byte;begin write('Nhap so can kiem tra: '); readln(n); str(n,chrn); for i:=1 to length(chrn) do begin val(chrn[i],valn,preperror); sum:=sum+valn; if max<valn then max:=valn; valn:=0 end; writeln('Ket qua: '); writeln(length(chrn)); writeln(sum); write(max); readln;end.
Program HOC24;
var N:longint;
max,tg,t,d: integer;
Begin
write('Nhap N : '); readln(N);
max:=0;
while n<>0 do
begin
tg:=n mod 10;
d:=d+1;
t:=t+tg;
if tg>max then max:=tg;
n:=n div 10;
end;
writeln('So nguyen N co ',d,' chu so');
writeln('Tong cac chu so cua N la : ',t);
write('Chu so lon nhat cua N la :',max);
readln
end.
Câu 1:
uses crt;
var a,b:integer;
begin
clrscr;
readln(a,b);
write(a+b);
readln;
end.
Câu 2:
uses crt;
var a,b,c:integer;
begin
clrscr;
readln(a,b,c);
writeln(a+b-c);
readln;
end.
Câu 3:
uses crt;
var a,b:integer;
begin
clrscr;
readln(a,b);
writeln(a-b);
readln;
end.
Câu 4:
uses crt;
var x,y,z:integer;
begin
clrscr;
readln(x,y,z);
writeln((x+y)*z);
readln;
end.
Bài 1:
uses crt;
var n,i,s:integer;
begin
clrscr;
write('Nhap n='); readln(n);
s:=0;
for i:=1 to n do
if i mod 6=0 then s:=s+i;
writeln(s);
readln;
end.
Bài 2:
uses crt;
var a,b,c,ucln,i:integer;
begin
clrscr;
write('a='); readln(a);
write('b='); readln(b);
write('c='); readln(c);
while a<>b do
begin
if a>b then a:=a-b
else b:=b-a;
end;
ucln:=a;
while ucln<>c do
begin
if ucln>c then ucln:=ucln-c
else c:=c-ucln;
end;
writeln(ucln);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a,b,c;
int main()
{
cin>>a>>b>>c;
cout<<a+b+c<<endl;
cout<<a*b*c;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a,b,c;
int main()
{
cin>>a>>b>>c;
cout<<a+b+c<<endl;
cout<<a*b*c;
return 0;
}
Câu 1:
var i,n:integer;
s:longint;
begin
Write('n = ');readln(n)
for i:=1 to n do
s:=s+2*i+1;
write('tong la: ',s);
readln
end.
Câu 2
Bài 5:
Var b:array:[1..1000] of integer;
i,n,max:integer;
Begin
Write('n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap so thu ',i,' = ');readln(b[i]);
End;
Write('Cac phan tu am la: ');
For i:=1 to n dko
if b[i]<0 then write(b[i]:8);
writeln;
max:=b[1];
For i:=2 to n do
If b[i] > max then max:=b[i];
write('So lon nhat la ',max);
Readln
End.
Câu 1:
uses crt;
var a,b:integer;
begin
clrscr;
write('Nhap a='); readln(a);
write('Nhap b='); readln(b);
if (a>0) and (b>0) then writeln('Cung duong');
if (a<0) and (b<0) then writeln('Cung am');
if (a>0) and (b<0) then writeln('Duong am');
if (a<0) and (b>0) then writeln('Am duong');
readln;
end.
Câu 2:
uses crt;
var a,b:integer;
begin
clrscr;
write('Nhap a='); readln(a);
write('Nhap b='); readln(b);
if (a mod 2=0) and (b mod 2=0) then writeln('Cung chan');
if (a mod 2<>0) and (b mod 2<>0) then writeln('Cung le');
if (a mod 2=0) and (b mod 2<>0) then writeln('Chan le');
if (a mod 2<>0) and (b mod 2=0) then writeln('Le chan');
readln;
end.
program cau_1;
uses crt;
var a,b,s:integer;
begin
clrscr;
write('nhap so a:'); readln(a);
writeln('nhap so b:');readln(b);
s:=0;
s:=a+b;
writeln('tong hai so a, b la:',s);
readln;
end.
jj