Professional Documents
Culture Documents
using System;
2.
using System.Collections.Generic;
3.
using System.Linq;
4.
using System.Text;
5.
6.
namespace ConsoleApplication1
7.
8.
class Program
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
if (iLength == 0)
21.
22.
23.
24.
25.
26.
else
27.
28.
29.
30.
31.
32.
33.
34.
if (initial == input)
35.
36.
37.
38.
else
39.
40.
41.
42.
43.
44.
Console.Read();
45.
46.
}
}
47.
48.
49.
Output:
1.
2.
MADAM
3.
MADAM is palindrome
1.
2.
RAJAN
3.
1.
using System;
2.
3.
namespace forgetCode
4.
5.
class Program
6.
7.
8.
9.
int n;
10.
11.
12.
13.
string s = Console.ReadLine();
14.
n = Int32.Parse(s);
15.
16.
17.
18.
string s1 = Console.ReadLine();
19.
a[i] = Int32.Parse(s1);
20.
21.
Console.Write("");
22.
large = a[0];
23.
small = a[0];
24.
25.
26.
27.
large = a[i];
28.
29.
30.
31.
32.
33.
34.
35.
36.
Output:
Enter the size of Array
6
Enter the array elements
23
11
98
65
54
43
Largest element in the array is 98
Smallest element in the array is 11
1.
2.
3.
4.
5.
int iNext = 1;
6.
int iNumber;
7.
8.
9.
10.
11.
iNumber= int.Parse(Console.ReadLine());
12.
13.
14.
15.
16.
17.
iPrevious = iNext;
18.
iNext = iSum;
19.
20.
Console.WriteLine(iNext);
21.
22.
Console.ReadLine();
23.
1.
using System;
2.
using System.Text.RegularExpressions;
3.
4.
namespace ForgetCode
5.
6.
7.
8.
9.
10.
11.
12.
int n = Convert.ToInt32(Console.ReadLine());
13.
14.
15.
16.
17.
18.
19.
Console.Write(" ");
20.
21.
Console.Write("*");
22.
23.
Console.Write("*");
24.
25.
Console.WriteLine();
}
26.
27.
28.
29.
30.
Console.Write(" ");
31.
32.
Console.Write("*");
33.
34.
Console.Write("*");
35.
Console.WriteLine();
36.
37.
38.
Console.WriteLine();
39.
40.
41.
42.
}
}
Output:
1.
2.
***
3.
*****
4.
*******
5.
*********
6.
*******
7.
*****
8.
***
9.
1.
using System;
2.
3.
namespace forgetCode
4.
5.
class Program
6.
7.
8.
9.
10.
11.
string s = Console.ReadLine();
12.
int x = Int32.Parse(s);
13.
Console.WriteLine("-----------------------");
14.
15.
Console.WriteLine("-----------------------");
16.
17.
18.
string s1 = Console.ReadLine();
19.
a[j] = Int32.Parse(s1);
20.
21.
int limit = x - 1;
22.
23.
24.
25.
26.
27.
28.
int k = a[j];
29.
30.
a[j + 1] = k;
31.
32.
33.
34.
35.
36.
Console.WriteLine("------------------------------------------------");
37.
38.
39.
Console.WriteLine(a[j]);
40.
41.
}
}
42.
Output:
Number of elements in the array ?
4
----------------------Array elements
----------------------23
12
45
34
-----------------------------------------------Sorted elements of an array are(bubble sort)
12
23
34
45
1.
using System;
2.
3.
namespace forgetCode
4.
5.
class Program
6.
7.
8.
9.
int binom = 1, q = 0, r, x;
10.
11.
12.
13.
string s = Console.ReadLine();
14.
int p = Int32.Parse(s);
15.
16.
17.
while (q < p)
18.
19.
//Pascal programming
20.
21.
22.
Console.Write(" ");
23.
24.
25.
if ((x == 0) || (q == 0))
26.
binom = 1;
27.
else
28.
29.
Console.Write(binom);
30.
31.
Console.Write("\n ");
32.
++q;
33.
34.
}
}
35.
36.
37.
Output:
Enter the number of rows
5
The Pascal Triangle
1
11
121
1331
14641
1.
using System;
2.
3.
namespace forgetCode
4.
5.
class Program
6.
7.
8.
9.
int n;
10.
11.
12.
13.
string s = Console.ReadLine();
14.
n = Int32.Parse(s);
15.
16.
17.
18.
string s1 = Console.ReadLine();
19.
a[i] = Int32.Parse(s1);
20.
21.
Console.Write("");
22.
large = a[0];
23.
small = a[0];
24.
25.
26.
27.
large = a[i];
28.
29.
small = a[i];
30.
31.
32.
33.
34.
35.
36.
Output:
Enter the size of Array
6
Enter the array elements
23
11
98
65
54
43
Largest element in the array is 98
Smallest element in the array is 11