var
a:array[1..100] of integer;
n,i,t:integer;
begin
write('n='); readln(n);
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
writeln('day so vua nhap la: ');
for i:=1 to n do
write(a[i]:4);
for i:=1 to n do
if a[i] mod 2=1 then
t:=t+a[i];
writeln('tong cac so nguyen le trong day la: ',t);
readln
end.
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package test01; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * * @author DOTNETGROUP */ public class Test01 { /** * @param args the command line arguments */ public static void main(String[] args) throws IOException{ // TODO code application logic here BufferedReader kbd = new BufferedReader(new InputStreamReader(System.in)); //System.out.print("Nhap a: "); //String s=kbd.readLine(); //int a=Integer.parseInt(s); System.out.print("Nhap n: "); String s=kbd.readLine(); int b=Integer.parseInt(s); for(int i = 1;i<b;i++) { int tong=0; for(int j=1; j<i;j++) { if(i%j==0) tong+=j; } if(i==tong) { System.out.println(i); } } } }