Friday, February 26, 2016

CSS: How to manipulate text using CSS properties

1. Text Direction
The direction property is used to set the text direction:
<html>
   <head>
   </head>
   <body>
      <p style="direction: rtl;">This text will be renedered from right to left</p>
   </body></html>
2. Space between Characters
The letter-spacing property is used to add or subtract space between the letters that make up a word:
<html>
   <head>
   </head>
   <body>
      <p style="letter-spacing: 10px;">This text is having space between letters.
      </p>
   </body>
</html>
3. Text Color
The color property is used to set the color of a text:
<html>
   <head>
   </head>
   <body>
      <p style="color:blue;">This text is blue</p>
   </body>
</html>

Thursday, May 21, 2015

Access: DROP TABLE Statement

'Example: Delete the Employees table from the database.

Sub DropEmployeesTable() 
 
    Dim dbase As Database 
 
    ' Modify this line to include the path to Northwind on your computer. 
    Set dbase = OpenDatabase("Northwind.mdb") 
 
    ' Delete the Employees table. 
    dbase.Execute "DROP TABLE Employees;" 
 
    dbase.Close 
 
End Sub

Saturday, July 19, 2014

C#: Enter the three numbers. Check to see that there is 3 sides of a triangle are not. If that is right, then see what kind of triangle.

//Enter the number 3. Check to see that there is 3 sides of a triangle are not. If that is right, then see what kind of triangle.
Source code:
class Program{
        static void Main() {
            float x, y, z;
            Console.Write("Input x: ");
            x = float.Parse(Console.ReadLine());
            Console.Write("Input y: ");
            y = float.Parse(Console.ReadLine());
            Console.Write("Input z: ");
            z = float.Parse(Console.ReadLine());
            if (x <= 0 || y <= 0 || z <= 0 || x + y <= z || y + z <= x || x + z <= y)
                Console.WriteLine("Input wrong !");
            else {
                if ((x == y && x * x * 2 == z * z) || (x == z && x * x * 2 == y * y) || (y == z && y * y * 2 == x * x))
                    Console.WriteLine("Triangle Square Scales");
                else {
                    if (x == y && y == z && z == x)
                        Console.WriteLine("Equilateral triangle");
                    else {
                        if (x == y || y == z || z == x)
                            Console.WriteLine("Isosceles triangle");
                        else
                            Console.WriteLine("Triangle");
                    }
                }
            }
            Console.ReadLine();
        }
}

Sunday, July 13, 2014

C#: Enter the integer n has 4 digits. Looking for big numbers second.

//Enter the integer n has 4 digits. Looking for big numbers second.
//Example: n=2071. The number big number second is 2
Source code:
class Program{
        static void Main(){           
            int n;
            int[] arr = new int[4];
            do
            {
                Console.Write("Input n has 4 digits: ");
                n = int.Parse(Console.ReadLine());
            } while (n < 1000 || n > 9999);           
            for (int i = 0; i < 4; i++){
                arr[i] = n % 10;
                n = n / 10;
            }
            for (int i = 0; i < 3; i++)
                for (int j = i+1; j < 4;j++)
                    if (arr[i] => arr[j]){
                        int temp = arr[i];
                        arr[i] = arr[j];
                        arr[j] = temp;
                    }            
            Console.WriteLine("The second big number is: {0}", arr[2]);   
            Console.ReadLine();
        }
}

C#: Calculate the sum of digits of N have 8 digits

/*  Enter an integer n has 8 digits. Take a look: 
- The total value of the digits 
- The value of the total unit 
- The average of the total   */
Source code:
class Program{
static void Main(){
            int n;
            Console.Write("Input n has 8 digits: ");
            n = int.Parse(Console.ReadLine());
            //The total value of the digits
            int s = 0;
            int balance;
            int first = n;
            while (n != 0) {
                balance = n % 10;
                s += balance;
                n /= 10;
            }
            //The value of the total unit
            int unit;
            unit = s % 10;
            //The average of the total
            double avg;
            avg = (double) s / 8;
            Console.WriteLine("The total value of the digits {0} is: {1}",first,s);
            Console.WriteLine("The value of the total unit {0} is: {1}",s,unit);
            Console.WriteLine("The average of the total {0} is: {1}",s,avg);
            Console.ReadLine();
        }
}

C#: Check Prime Number !

//Write program with Console Application type, enter the number N from the keyboard. Check whether n is prime no.
Source code:
class Program{
        static void Main(string[] args)
        {
            int n;
            bool prime = true;
            Console.Write("Input n: ");
            n = int.Parse(Console.ReadLine());           
            if (n <= 1) prime = false;
            else {
                if (n == 2) prime = true;
                for (int i = 2; i <= Math.Sqrt(n); i++)
                    if (n % i == 0) { prime = false; break; }
                    else prime = true;
            }
            if (prime == true) Console.WriteLine("{0} is prime no",n);
            else Console.WriteLine("{0} is not prime number", n);
            Console.ReadLine();
        }

    }

Sunday, June 29, 2014

C#: Find the Greatest Common Divisor of Two Integers which input from the keyboard

//Find the Greatest Common Divisor of Two Integers which input from the keyboard
The Greatest Common Divisor (GCD) of two whole numbers, also called the Greatest Common Factor (GCF) and the Highest Common Factor (HCF), is the largest whole number that's a divisor (factor) of both of them. For instance, the largest number that divides into both 20 and 16 is 4. (Both 16 and 20 have larger factors, but no larger common factors -- for instance, 8 is a factor of 16, but it's not a factor of 20.)
Source code:
class Program{
        static void Main(){
            int a, b;
            do{
                Console.WriteLine("Input a: ");
                a = int.Parse(Console.ReadLine());
                Console.WriteLine("Input b: ");
                b = int.Parse(Console.ReadLine());
            } while (a == 0 || b == 0);
            Math.Abs(a);
            Math.Abs(b);
            while (a != b){
                if (a > b) a = a - b;
                else b = b - a;
            }
            Console.WriteLine("Highest Common Factor: {0}",a);
            Console.ReadLine();
        }
}