3/15/2012
2/02/2012
C# Number Pattern (28)
C# Number Pattern (28) |
/* C# program to print the following pattern 0 909 89098 7890987 678909876 56789098765 4567890987654 345678909876543 23456789098765432 1234567890987654321 */ namespace Patterns { class Program { static void Main(string[] args) { int i, j; Console.WriteLine("0"); for (i = 9; i >= 1; i--) { for (j = i; j <= 9; j++) Console.Write( j); Console.Write("0"); for (j = 9; j >= i; j--) Console.Write(j); Console.WriteLine(); } } } }
C# Number Pattern (27)
C# Number Pattern (27) |
/* C# program to print the following pattern
1
121
12321
1234321 */
namespace Patterns
{
class Program
{
static void Main(string[] args)
{
int i, j;
for (i = 1; i <= 4; i++)
{
for (j = 1; j <= i; j++)
Console.Write(j);
for (j = i - 1; j >= 1; j--)
Console.Write(j);
Console.WriteLine();
}
}
}
}
C# Number Pattern (26)
C# Number Pattern (26) |
/* C# program to print the following pattern
5432*
543*1
54*21
5*321
*4321 */
namespace Patterns
{
class Program
{
static void Main(string[] args)
{
int i, j;
for (i = 1; i <= 5; i++)
{
for (j = 5; j >= 1; j--)
{
if (i == j)
Console.Write("*");
else
Console.Write(j);
}
Console.WriteLine();
}
}
}
}
C# Number Pattern (25)
C# Number Pattern (25) |
/* C# program to print the following pattern 11111 2222 333 22 1 */ namespace Patterns { class Program { static void Main(string[] args) { int i, j; for (i = 1; i <= 5; i++) { for (j = 5; j >= i; j--) { if (i <= 3) Console.Write(i); else Console.Write(6 - i); } Console.WriteLine(); } } } }
C# Number Pattern (24)
C# Number Pattern (24) |
1: /* C# program to print the following pattern
2: 1
3: 2 3 4
4: 5 6 7 8 9 */
5: namespace Patterns
6: {
7: class Program
8: {
9: static void Main(string[] args)
10: {
11: int i, j, k;
12: k = 1;
13: for (i = 1; i <= 5; i += 2)
14: {
15: for (j = 5; j >= 1; j--)
16: {
17: if (j > i)
18: Console.Write(" ");
19: else
20: Console.Write(" " + k++);
21: } Console.WriteLine();
22: }
23: }
24: }
25: }
C# Number Pattern (23)
C# Number Pattern (23) |
/* C# program to print the following pattern 12344321 123**321 12****21 1******1 */ namespace Patterns { class Program { static void Main(string[] args) { int i, j, k; for (i = 4; i >= 1; i--) { for (j = 1; j <= 4; j++) { if (j <= i) Console.Write(j); else Console.Write(" "); } for (j = 4; j >= 1; j--) { if (j <= i) Console.Write(j); else Console.Write(" "); } Console.WriteLine(); } } } }
C# Number Pattern (21)
C# Number Pattern (21) |
/* C# program to print the following pattern
1
2 6
3 7 10
4 8 11 13
5 9 12 14 15 */
namespace Patterns
{
class Program
{
static void Main(string[] args)
{
int i, j, k;
for (i = 1; i <= 5; i++)
{
k = i;
for (j = 1; j <= i; j++)
{
Console.Write(k);
k += 5 - j;
}
Console.WriteLine();
}
}
}
}
C# Number Pattern (18)
C# Number Pattern (18) |
/* C# program to print the following pattern
55555
45555
34555
23455
12345 */
namespace Patterns //18
{
class Program
{
static void Main(string[] args)
{
int i, j, k;
for (i = 5; i >= 1; i--)
{
k = i;
for (j = 1; j <= 5; j++)
{
if (k <= 5)
{
Console.Write(k);
}
else
{
Console.Write("5");
}
k++;
}
Console.WriteLine();
}
}
}
}
C# Number Pattern (17)
C# Number Pattern (17) |
/* C# program to print the following pattern
1
2 4
1 3 5
2 4 6 8
1 3 5 7 9 */
namespace Patterns
{
class Program
{
static void Main(string[] args)
{
int i, j, k;
for (i = 1; i <= 5; i++)
{
if (i % 2 == 0)
{
k = 2;
}
else
{
k = 1;
}
for (j = 1; j <= i; j++, k += 2)
{
Console.Write(k);
}
Console.WriteLine();
}
}
}
}
C# Number Pattern (13)
C# Number Pattern (13) |
/* C# program to print the following pattern
12345
4321
123
21
1 */
namespace Patterns
{
class Program
{
static void Main(string[] args)
{
int i, j, k;
for (i = 5; i >= 1; i--)
{
if (i % 2 == 1) k = 1;
else k = i;
for (j = 1; j <= i; j++)
{
Console.Write(k);
if (i % 2 == 1) k++;
else k--;
}
Console.WriteLine();
}
}
}
}
2/01/2012
1/12/2012
Web Services
Web Services: It is a communication between two applications over the internet. The web service can be used via Internet or a Cloud. It may be stated that web service has helped in blurting the line between thin clients and thick clients. The functionalities that earlier considered apt to only websites, can now be used by a desktop client.
1/11/2012
percentage of change in C# windows Form Application
Percentage Of Change Calculator in C# Windows Form |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | using System; using System.Windows.Forms; namespace PercentageOfChangeCalculator { public partial class MainForm : Form { double initial, final; public frmPercentageOfChangeCalculator() { InitializeComponent(); } private void clearButton_Click(object sender, EventArgs e) { initialValueTextBox.Clear(); finalValueTextBox.Clear(); initialValueTextBox.Focus(); resultLabel.Text = null; } private void calculateButton_Click(object sender, EventArgs e) { if (double.TryParse(initialValueTextBox.Text, out initial) && double.TryParse(finalValueTextBox.Text, out final)) { double percentage = ((final - initial) / initial) * 100; resultLabel.Text = $"Percentage of change: {percentage}%"; } else { MessageBox.Show("Please enter valid numeric values for initial and final values."); } } } } |