This C# program demonstrates how to use the if statement.
using System;
namespace XoaX {
class Program {
static void Main(string[] args) {
string sString = "";
for (int i = 0; i < 20; ++i) {
char c = '+';
// Change every character at an even index to '*'
if ((i % 2) == 0) {
c = '*';
}
sString += c;
}
Console.WriteLine(sString);
}
}
}
*+*+*+*+*+*+*+*+*+*+ Press any key to continue . . .
© 20072024 XoaX.net LLC. All rights reserved.