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 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(t);
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to n do
if a[i] mod 2<>0 then write(a[i]:4);
readln;
end.
#include <stdio.h>
#include <conio.h>
#include <math.h>
int main()
{
int n,i,x[10];
printf("nhap so luong phan tu");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("x[%d]",i);
scanf("%d",&x[i]);
}
printf("mang x[i] da nhap vap");
for(i=0;i<n;i++)
{
printf("%2d",x[i]);
} for(i=0;i<n;i++)
{
if(nt(x[i],n)==1)
{
printf("cac so nguyen to co trong mang la %d",x[i]);
}
}
}
int nt(int x[10],int n)
{
int i,j;
int kt;
for(i=0;i<n;i++)
{
kt=1;
for(j=2;j<x[i];j++)
{
if(x[i]%j==0) kt=0;
}
}
if(kt)
{
return 1;
}
else
{
return 0;
}
}
Program HOC24;
var d,i,n: integer;
a: array[1..1000] of integer;
begin
write('Nhap do dai cua day: '); readln(n);
for i:=1 to n do
begin
write('Nhap phan tu thu ',i,': '); readln(a[i]);
end;
d:=0;
for i:=1 to n do if a[i] mod 2=1 then d:=d+1;
write('Co tat ca ',d,' gia tri le');
readln
end.
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]>0 then t:=t+a[i];
writeln(t);
readln;
end.
Câu 2:
uses crt;
var a:array[1..100]of integer;
i,n,tb:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
tb:=0;
for i:=1 to n do
tb:=tb+a[i];
writeln(tb/n:4:2);
readln;
end.
uses crt;
var a:array[1..1000000] of longint;
n,i,d:longint;
begin
clrscr;
write('Nhap so luong phan tu: '); readln(n);
for i:=1 to n do
begin
write('Nhap phan tu thu ',i,': '); readln(a[i]);
if a[i] mod 2=1 then inc(d);
end;
write('Co ',d,' gia tri la so le');
readln;
end.
uses crt;
var a:array[1..1000000] of longint;
n,i,s:longint;
begin
clrscr;
write('Nhap so luong phan tu: '); readln(n);
for i:=1 to n do
begin
write('Nhap phan tu thu ',i,': '); readln(a[i]);
if a[i] mod 2=1 then inc(s,a[i]);
end;
write('Tong cac so le: ',s);
readln;
end.
Var a:array:[1..1000] of integer;
i,n,max:integer;
Begin
Write('Nhap so luong phan tu n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap diem thu ',i,' = ');readln(a[i]);
End;
Write('Cac diem vua nhap la: ');
For i:=1 to n do
Write(a[i]:8);
writeln;
max:=a[1];
For i:=2 to n do
if a[i] > max then max:=a[i];
write('So lon nhat la ',max);
Readln
End.
uses crt;
var a:array[1..100]of integer;
i,n:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to n do
if a[i] mod 2<>0 then write(a[i]:4);
readln;
end.
uses crt;
var i,n: integer;
a: array[1..10000] of integer;
begin
writeln('nhap so nguyen n: '); readln(n);
for i:=1 to n do
begin
writeln('A[',i,']'); readln(a[i]);
if i mod 2 <>0 then writeln(i);
end;
readln;
end.