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.
uses crt;
var s,i:integer;
begin
clrscr;
s:=0;
for i:=1 to 20 do
if i mod 2=0 then s:=s+i;
writeln('Tong cac so chan trong khoang 20 so tu nhien dau tien la: ',s);
readln;
end.
1:
#include <bits/stdc++.h>
using namespace std;
long long dem,i,n,x;
int main()
{
cin>>n;
dem=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x%2==0) dem++;
}
cout<<dem;
return 0;
}
Câu 2:
#include <bits/stdc++.h>
using namespace std;
long long x,n,i,t;
int main()
{
cin>>n;
t=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x%3==0) t+=x;
}
cout<<t;
return 0;
}
program bai1;
uses crt;
var a,b,c,s: real;
begin
clrscr;
write('nhap so thu nhat ='); readln(a);
write('nhap so thu hai ='); readln(b);
write('nhap so thu ba ='); readln(c);
s:=a+b+c;
writeln('tong ba so a,b,c =',s:4:2);
readln;
end.
program bai1;
uses crt;
var n: integer;
begin
clrscr;
write('nhap so n ='); readln(n);
if n mod 2 = 0 then
writeln('la so chan ') else
writeln('la so le ');
readln;
end.
uses crt;
var i,t:integer;
begin
clrscr;
i:=1;
t:=0;
repeat
t:=t+i;
inc(i);
until t>=100;
writeln(t);
readln;
end.
1.
program tinhtong;
uses crt;
var s,i,n:integer;
begin
s:=0;
for i:=1 to 10 do s:=s+1;
writeln ('tong cua s=',s);
readln
end.
2.
program tinhtong;
uses crt;
var i,L,s:integer;
begin
write('nhap gia tri L='); readln(L);
s:=0;
for i:=1 to L do s:=s+1;
writeln('tong cua s=',s);
readln
end.
program tong_100_so_tu_nhien;
uses crt;
var i, S: integer;
begin
S := 0;
for i := 1 to 100 do
S := S + i;
writeln('Tong cua 100 so tu nhien dau tien la ', S);
readln;
end.
Var i,s:integer;
Begin
i:=1;
s:=0;
While i<=100 do
Begin
s:=s+i;
i:=i+1;
End;
Write('Tong la ',s);
Readln;
End.
uses crt;
var i,t:integer;
begin
clrscr;
t:=0;
for i:=1 to 20 do
t:=t+i;
writeln(t);
readln;
end.
tk:
https://hoc247.net/hoi-dap/tin-hoc-8/viet-chuong-trinh-tinh-tong-100-so-tu-nhien-dau-tien-faq247722.html
rảnh hả