Reverse a string without any use of predefined function
- public static void Main()
- {
- int n = 0;
- Console.WriteLine("Enter a string");
- string s = Console.ReadLine();
- string rev = "";
- foreach (char c in s)
- {
- n++;
- }
- while (n > 0)
- {
- rev = rev + s[n - 1];
- n = n - 1;
- }
- Console.WriteLine(rev);
- Console.ReadKey();
- }
Find out Second smallest number
- int[] n = new int[5];
- Console.WriteLine("Enter 5 number");
- for (int p = 0; p < 5; p++)
- {
- n[p] = Convert.ToInt32(Console.ReadLine());
- }
- int com = n[0];
- //sorting in ascending
- int temp = 0;
- for (int i = 0; i < 5; i++)
- {
- for (int j = i + 1; j < 5; j++)
- {
- if (n[i] > n[j])
- {
- temp = n[i];
- n[i] = n[j];
- n[j] = temp;
- }
- }
- }
- Console.WriteLine("Second Smallest Number is " + n[1]);
- Console.ReadKey();

Find the length of string without any use of predefined function
- string s;
- int c = 0;
- int noofA = 0;
- Console.Write("Enter the string: ");
- s = Console.ReadLine();
- foreach (char p in s)
- {
- c++;
- }
- Console.WriteLine("Totol Length is " +c);
- Console.ReadKey();

Print Pyramid Triangles
- for (int p = 1; p <= 5; p++)
- {
- for (int i = p; i <= 4; i++)
- {
- Console.Write(" ");
- }
- for (int j = 1; j <= p; j++)
- {
- Console.Write(" "+p);
- }
- for (int k = p - 4; k > 1; k--)
- {
- Console.Write(" "+p);
- }
- Console.WriteLine("");
- }
- Console.ReadKey();

If this helps any one I feel pleasure.

Siva PoolaPosted Apr 27, 2015, 3:12 AM
nice work
Aditya MishraPosted Apr 23, 2015, 7:16 AM
nice..
Nanhe SiddiquePosted Apr 20, 2015, 8:03 AM
thanks khargesh and thanks jitendra
Jitendra KumarPosted Apr 20, 2015, 7:50 AM
Good one..
Khargesh RajputPosted Apr 20, 2015, 7:49 AM
nice