Você está na página 1de 2

4.

b.

for (int i = 0; i< notas.length; i++)

notas[i] = Teclado.leDouble( “digite uma nota: ” );

c.

for (int i = 0; i< v.length; i++)

v[i] = 10+(int)(Math.random()*50);

d.

int [] v = new int[11];

int [] v = {0,1, 3, 6, 10, 15, 21, 28, 36, 45, 55};

for (int i = 0; i< v.length; i++)

if (I == 0);

v[i] = 0;

else(i =! 0);

v[i] = v[i – 1] + v[i];

5.

a.

Vamos considerer um array com 4 elementos

int a[] = {1,2,3,4};

int produto = 1, i;

for (i = 0; i < 4; i++) {

produto *= a[i];

b.

for (int i = 0; i< a.length; i++)


media = a[i] + a[i+1]/2;

c.

for (int i = 0; i< a.length; i++)

if (a[i]<0)

a[i] = -1;

else if (a[i]>0)

a[i] = 1;

else

a[i] = 0;

Você também pode gostar