Visual basic
2)
3) int total = 2;
4) for (int i = 0; i < 5; i += 1)
5) {
6)
7) total = total * 2;
8) }
9) MessageBox.Show("O total é: " + total);
10)
11) • 256
12) • 64
13) • 128
14) • 512
15)
Resposta:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
int total = 2; for (int i = 0; i < 5; i++) { total *= 2;
} Console.WriteLine("total = "+total); Console.ReadKey();
64
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2) FPC# que imprima a soma dos números de 1 até 1000.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> int y =0;
for (int x = 1; x <= 1000; x++) {
y += x;
} Console.Write(y); Console.ReadKey();
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3) FPC# que imprima todos os múltiplos de 3, entre 1 e 100. Para saber se um número é múltiplo de 3, você pode fazer if(numero % 3 == 0).
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
for (int i = 0; i <=100; i++) { if(i % 3 == 0)
Console.WriteLine(i); } Console.ReadKey();
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
4) FPC# que some todos os números de 1 a 100, pulando os múltiplos de 3 O programa deve imprimir o resultado final em uma MessageBox. Qual o resultado?
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> int cont = 0; for (int i = 0; i <=100; i++) { if(i % 3 != 0) cont+=i;
} Console.WriteLine(cont); Console.ReadKey(); 5) FPC# que imprime todos os