tinh tong cac so nguyen a sao cho:
-50<a<hoac bang 50
-100 nho hon hoac bang a va a nho hon 100
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.
A:
uses crt;
var t,i,n:integer;
begin
clrscr;
write('Nhap n='); readln(n);
t:=0;
for i:=1 to n do
t:=t+i;
writeln(t);
readln;
end.
B:
uses crt;
var a:array[1..100]of integer;
i,n,t:integer;
begin
clrscr;
write('Nhap m='); readln(m);
for i:=1 to m do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to m do
t:=t+a[i];
writeln(t);
readln;
end.
a, - 3 \(\le\) n < 5
n \(\in\left\{-3;-2;-1;0;1;2;3;4\right\}\)
b, Tổng :
- 3 + ( - 2 ) + ( - 1 ) + 0 + 1 + 2 + 3 + 4
= [ ( - 3 ) + 3 ] + [ ( - 2 ) + 21 ] + [ ( - 1 ) + 1 ] + 0 + 4
= 0 + 0 + 0 + 0 + 4 = 4
#include <bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,t;
int main()
{
cin>>a>>b>>c>>d>>e;
t=0;
if ((a%10==0) or (a%10==5)) t=t+a;
if ((b%10==0) or (b%10==5)) t=t+b;
if ((c%10==0) or (c%10==5)) t=t+c;
if ((d%10==0) or (d%10==5)) t=t+d;
if ((e%10==0) or (e%10==5)) t=t+e;
cout<<t;
return 0;
}
Câu 2:
Program HOC24;
var a: array[1..20] of integer;
t,i: integer;
begin
for i:=1 to 20 do
begin
write('Nhap so thu ',i,' : '); readln(a[i]);
end;
t:=0;
for i:=1 to 20 do
if a[i] mod 2<>0 then t:=t+a[i];
writeln('Tong cac so le la :',t);
readln
end.
Câu 1:
Program HOC24;
var a: array[1..10] of integer;
min,max,i: integer;
begin
for i:=1 to 10 do
begin
write('Nhap so thu ',i,' : '); readln(a[i]);
end;
min:=32000; max:=0;
for i:=1 to 10 do
begin
if max<a[i] then max:=a[i];
if min>a[i] then min:=a[i];
end;
writeln('So lon nhat la :',max);
write('So nho nhat la : ',min);
readln
end.
bai1 tu -1738 den -16 co so cac so nguyen am la : (1738-16)/2+1=862
C1
B=1+3+5+..+99=50.(99+1)/2=50.50=2500
C=-(2+4+6+...+100)=50.(100+2)/2=50*51=-2550
A=B+C=2500-2550=-50
C2
A=1+(3-2)+(5-4)+...+(99-98)+100
=1+1+1+...+1-100
=1+49-100=-50