3 svar
51 visningar
husshy10 3
Postad: 10 nov 2022 17:11

while char

using System;

namespace Problem11
{
class Problem11
{
static void Main(string[] args)
{
char ch;
int i = 1;
int j = 0;
while (i <= 16)
{
j = i + 64;
ch = (char) j;
Console.Write(ch);
Console.Write(" ");
i = i * 2;
}
Console.ReadKey();
}
}
}

output: A B D H P

 

kan nån förklara hur output bilr så?

tack!

Fermatrix 7841 – Fd. Medlem
Postad: 10 nov 2022 17:24

Kika på ASCII tabellen och ta en iteration i taget så tror jag det klarnar.

Laguna Online 28563
Postad: 10 nov 2022 17:40

Ser du vilka värden 'i' får i tur och ordning?

husshy10 3
Postad: 15 nov 2022 15:30

nu förstår jag det tack för hjälpen:)

Svara Avbryt
Close