Sunday, May 24, 2009

Exercise

/* Custom Project and Libraries Copyright, 2006. Venkat, ISS */

using System;
using System.Collections.Generic;
using System.Text;
using ISS.RV.LIB;

namespace Prog00
{
class Progo2
{
static void Main()
{
// Write the Main Program for Progo2 here...
int C;
double F;
Console.WriteLine("Enter Centigrade:");
ISSConsole.ReadInt(C);
F = 1.8 * C + 32;
Console.WriteLine(F);



#region /* Do not remove this or write codes after this */
ISSConsole.Pause();
#endregion
}
}
}

Exercise

/* Custom Project and Libraries Copyright, 2006. Venkat, ISS */

using System;
using System.Collections.Generic;
using System.Text;
using ISS.RV.LIB;

namespace Prog00
{
class Prog01
{
static void Main()
{
// Write the Main Program for Prog01 here...

double a, b;
Console.WriteLine("Enter salary:");
a = ISSConsole.ReadDouble();
b = a + 0.1 * a + 0.03 * a;
Console.WriteLine(b);

#region /* Do not remove this or write codes after this */
ISSConsole.Pause();
#endregion
}
}
}

Exercise

/* Custom Project and Libraries Copyright, 2006. Venkat, ISS */

using System;
using System.Collections.Generic;
using System.Text;
using ISS.RV.LIB;

namespace Prog00
{
class exe5
{
static void Main()
{
// Write the Main Program for exer2 here...
double d,A;

Console.WriteLine("Enter a number:" + "\t");
d = ISSConsole.ReadDouble();
A= Math.Sqrt(d);
Console.WriteLine("the result is {0:###.##}",A);


}
}
}

Exercise

/* Custom Project and Libraries Copyright, 2006. Venkat, ISS */

using System;
using System.Collections.Generic;
using System.Text;
using ISS.RV.LIB;

namespace Prog00
{
class EX37
{
static void Main()
{
// Write the Main Program for EX37 here...


string s = "institute of system science";
string r = s.Substring(0, 1);
Console.WriteLine(r.ToUpper ());
//s.Substring(10, 1) = s.ToUpper();
//s.Substring(13, 1) = s.ToUpper();
//s.Substring(20, 1) = s.ToUpper();

Console.WriteLine(s);
#region /* Do not remove this or write codes after this */
ISSConsole.Pause();
#endregion
}
}
}

Exercise

/* Custom Project and Libraries Copyright, 2006. Venkat, ISS */

using System;
using System.Collections.Generic;
using System.Text;
using ISS.RV.LIB;

namespace Prog00
{
class EX36
{
static void Main()
{
// Write the Main Program for EX36 here...

//String s = "radar";
//string r=s.Substring ()
string s;
//int i;

Console.WriteLine("Enter a string:");
s = ISSConsole.ReadString();

Console.WriteLine(s.Length);

Console.WriteLine(s.ToLower());

//char[] c = new char[] { ' ', '.' };
string []r = s.Split (' ');

Console.WriteLine(r);


for (int i = 0; i <= s.Length-1;i++ )
{


if ((s.Substring(0, 1) == s.Substring(4, 1)) && (s.Substring(1, 1) == s.Substring(3, 1)))
{
Console.WriteLine("Palindrome");
}
}



//string l = s.Substring(1, 1);
//Console.WriteLine(l);
//string m = s.Substring(2, 1);
//Console.WriteLine(m);
//Console.WriteLine(s.CompareTo(r));
//if (s.Equals(r))
//{
// Console.WriteLine("Palindrome");
//}


#region /* Do not remove this or write codes after this */
ISSConsole.Pause();
#endregion
}
}
}

Exercise

/* Custom Project and Libraries Copyright, 2006. Venkat, ISS */

using System;
using System.Collections.Generic;
using System.Text;
using ISS.RV.LIB;

namespace Prog00
{
class Ex32
{
static void Main()
{
// Write the Main Program for Ex32 here...
int s=0, m=0;

string[] month = new string[12];

int[] sale = new int[11];

for ( m = 0; m < month.Length; m++)
{
Console.WriteLine("Month:{0}", m);

//for (int i = 0; i <= 12;i++ )
//{
// Console.WriteLine("Enter the Sale:");
// ISSConsole.ReadInt();
//}

Console.WriteLine("Enter the Sale:");
s = ISSConsole.ReadInt();
}

if (s > (sale.Length))
{
Console.WriteLine("Maxi sale month:{0}", m);
}
else
{
Console.WriteLine ("Mini sale month:{0}",m);
}





#region /* Do not remove this or write codes after this */
ISSConsole.Pause();
#endregion
}
}
}

String Exercise

/* Custom Project and Libraries Copyright, 2006. Venkat, ISS */

using System;
using System.Collections.Generic;
using System.Text;
using ISS.RV.LIB;

namespace Prog00
{
class ArrSamp
{
static void Main()
{
// Write the Main Program for ArrSamp here...

string[] name = new string[] { "chaw", "yin", "hla" };

Console.WriteLine(name.Length);

for (int i = 0; i < name.Length; i++)
{
Console.WriteLine(name[i]);
}


#region /* Do not remove this or write codes after this */
ISSConsole.Pause();
#endregion
}
}
}

Exercise

/* Custom Project and Libraries Copyright, 2006. Venkat, ISS */

using System;
using System.Collections.Generic;
using System.Text;
using ISS.RV.LIB;

namespace Method
{
class Exercise
{
static void Main()
{
// Write the Main Program for Exercise here...


int number = ISSConsole.ReadInt("Enter the number");
Console.WriteLine( "The factorial Number is:"+ NumberType(number));
}
static int NumberType(int num )
{
int i;
int fact = 1;
//num = ISSConsole.ReadInt();
for (i = 1; i <= num; i++)
{
fact = fact * i;

//Console.WriteLine(fact);
}
return fact;



#region /* Do not remove this or write codes after this */
//ISSConsole.Pause();
#endregion
}
}
}

String Exercise

/* Custom Project and Libraries Copyright, 2006. Venkat, ISS */

using System;
using System.Collections.Generic;
using System.Text;
using ISS.RV.LIB;

namespace Method
{
class Exercise45
{
static void Main()
{
// Write the Main Program for Exercise45 here...
string s1 = ISSConsole.ReadString("Enter the value of first string:");
string s2 = ISSConsole.ReadString("Enter the value of second string:");
Console.WriteLine("Return value:" + FindWord(s1,s2));
#region /* Do not remove this or write codes after this */
ISSConsole.Pause();
#endregion
}
static int FindWord(string s1,string s2)
{
int i;

for (i = 0; i < s1.Length; i++)
{
//s1.CompareTo(s2);
if (s1.CompareTo(s2) == 0)
{
Console.WriteLine(s1.Length);

}
}
// return find;
return s1.Length;

}


}
}

String Exercise

/* Custom Project and Libraries Copyright, 2006. Venkat, ISS */

using System;
using System.Collections.Generic;
using System.Text;
using ISS.RV.LIB;

namespace Method
{
class Exercise44
{
static void Main()
{
// Write the Main Program for Exercise44 here...
string s = ISSConsole.ReadString("Enter the input string");
string c1 = ISSConsole.ReadString("Enter the change character");
string c2 = ISSConsole.ReadString("Enter the insert character");

//char c1 = ISSConsole.ReadChar("Enter the change character");
//char c2 = ISSConsole.ReadChar("Enter the insert character");
Console.WriteLine("Change character" + StringType(s,c1,c2));

#region /* Do not remove this or write codes after this */
ISSConsole.Pause();
#endregion
}
static string StringType(string s, string c1, string c2)
{
int i;
//string r;
for (i = 0; i < s.Length; i++)
{
if ( s.Substring(i,1) == c1)
{
s = s.Remove (i,1);
s = s.Insert (i,c2);
}

}
return s;

}
}
}

Finding a Square Root

/* Custom Project and Libraries Copyright, 2006. Venkat, ISS */

using System;
using System.Collections.Generic;
using System.Text;
using ISS.RV.LIB;

namespace Method
{
class exercise42
{
static void Main()
{
double number = ISSConsole.ReadInt("Enter the number");
//Console.WriteLine("The Square root Number is:" + NumberType(number));
Console.WriteLine(" Square root of {0} is {1}", number, NumberType(number));


#region /* Do not remove this or write codes after this */
ISSConsole.Pause();
#endregion
}
static double NumberType(double num)
{

double G = ISSMath.RND() * num;

while (Math.Abs(G * G - num) > 0.0000001)
{
G = (G + num/ G) / 2;

//Console.WriteLine("{0:0.0000000}", G * G - num);
}

// Console.WriteLine(" Square root of {0} is {1}", num, G);
return G;

}
}
}