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..15] of integer;
i,s:integer;
Begin
I:=1;
While i<=15 do
Begin
Write('Nhap phan tu thu ',i,' = ');readln(a[i]);
s:=s+a[i];
i:=i+1;
End;
Write('Tong la ',s);
Readln;
End.
Bài 1
Var s,i:integer;
tb:real;
Begin
Write('Nhap n = ');readln(n);
i:=1;
s:=0;
While i<=n do
Begin
s:=s+i;
i:=i+1;
End;
tb:=s/n;
Writeln('Tong la ',s);
Write('Trung binh la ',tb:10:2);
Readln;
End.
Bài 2
Var i,n,souoc:integer;
Begin
Write('Nhap n = ');readln(n);
i:=1;
While i <= n do
Begin
i:=i + 1;
If n mod i = 0 then souoc:=souoc + 1;
End;
If souoc = 1 then write(n,' la so nguyen to')
Else write(n,' khong la so nguyen to');
Readln;
End.
Program HOC24;
var i,n: integer;
t: longint;
a: array[1..1000] of integer;
begin
write('Nhap n: '); readln(n);
for i:=1 to n do
begin
write('Nhap so thu ',i,': '); readln(a[i]);
end;
t:=0;
for i:=1 to n do if a[i] mod 2=0 then t:=t+a[i];
write('Tong cac so chan la: ',t);
readln
end.
uses crt;
var a:array[1..100]of integer;
i,n,t:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
t:=0;
for i:=1 to n do
if a[i]>0 then t:=t+a[i];
writeln(t);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,t=0;
cin>>n;
for (int i=1; i<=n; i++)
if (i%6==0) t+=i;
cout<<t;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long n,i,t;
int main()
{
cin>>n;
t=0;
for (i=1; i<=n; i++)
if (i%2==0) t+=i;
cout<<t;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long n,i,t;
int main()
{
cin>>n;
t=0;
for (i=1; i<=n; i++)
if (i%2!=0) t+=i;
cout<<t;
return 0;
}
Uses Crt;
Var A : array [1..1000] of longint;
n, m, d, t, i, S, k : longint;
Begin
//Phan A
Clrscr;
Writeln(' Phan A ');
Write(' Ban hay nhap 1 so n bat ky: ');
Readln(n);
Write(' Cac so chia het cho ba tu 1 den ',n,' la: ');
For i:=1 to n do
If (i mod 3) = 0 then Write(' ',i);
//Phan B
Writeln;
Writeln(' Phan B ');
Write(' Ban hay nhap 1 so m bat ky: ');
Readln(m);
For i:=1 to m do
Begin
Write(' Ban hay nhap hang tu thu ',i,': ');
Readln(A[i]);
S:= S+A[i];
End;
Write(' Tong cua day so tren la: ',S);
//Phan C
Writeln;
Writeln(' Phan C ');
Write(' Ban hay nhap 1 so d bat ky: ');
Readln(d);
Write(' Ban hay nhap so K: ');
Readln(k);
For i:=1 to n do
Begin
Write(' Ban hay nhap hang tu thu ',i,': ');
Readln(A[i]);
If ((A[i] div k)=1)then t:=t+1;
End;
Write(' Co tat ca ',t,' so giong ',k);
Readln;
End.