Thursday, September 29, 2011

Get Started Basic HTML TAGS

Requirements to study HTML
A text editor
A Web browser
Where you can type the code
Open a text editor like notepad and type the code and save the file as somename.html    The .html is very important


<HTML> - Opening Tag of html Page
</HTML> - Closing tag of a html page

Titles of your webpages

 You can set the titles appearing on web browsers using <title> tag .It can be used as 
<title> Type The Title You Want To Appear </title>

Heading Of a Webpage

You can use <h1> , <h2> , <h3> , <h4> , <h5> , <h6> Tags for headings
These are the results and respective codes of Heading tags

This is a H1 heading  Code -  <h1> This is a H1 heading</h1>

This is a H2 heading         code -   <h2> This is a H2 heading</h2>

This is a H3 heading              code    <h3> This is a H3 heading</h3>

This is a H4 heading                code    <h4> This is a H4 heading</h4>

This is a H5 heading                   code     <h5> This is a H5 heading</h5>
This is a H6 heading                                code    <h6> This is a H6 heading</h6>

Links In a Webpage
     <a href="Type The target of the web address  here"> The Text To be Linked Here </a>
The target of your web page may type after href attribute . See this example


Result digipool
Code --  <a href="http://digipool.blogspot.com/">digipool </a>


In the above example http://digipool.blogspot.com/  is the target address and digipool is the text to be linked.



Wednesday, September 28, 2011

PHP Program Syntax

We can use PHP code between HTML codes .The PHP code must begin with <?php and end with ?> . PHP  may insert between HTML tags but you need to specify it . Using this <?php ?>  we can separate  PHP codes from HTML tags. At executing time server will avoid html tags from execution of the program. If you need to print html tags you can use 


Echo " <html Tag here>";


Eg :


<html>
<p><b> This is a html page contain PHP codes </b></>
<img src="somepicture's path"></img>
PHP code begins here


<?php
printf("This is a block of PHP codes");
?>


<b>PHP code ends</b>
</html>


Printf is used to print some charecters in a html page



Create Database in PHP Mysql

It is very easy to create database in xampp.You can create Databases By directly executing the SQL query Or using PHP Myadmin


Using PHP Myadmin 
Goto http://localhost/phpmyadmin/
Type the name of the database and click on create


 Type the name of table and Number of fields click on GO
 Type the name of field , type , length and click on GO
Now the database with table and fields is created


You may create database by executing the SQL query directly .










Tags : How to create database in mysql, how to create database tables in php , how to create database in apache server , how to create database  and tables in xampp , create database in PHP  without using query , GUI interface for creating database in xampp , my first php database program

Tuesday, September 27, 2011

Running a PHP Script

PHP is the simplest language among server side programming languages.There is no need of virtual machines to execute php code in clients computer.It is totally different from other languages like C , C++ , VB etc.To run a PHP script we need to install a package Xampp Or Wamp. 


Download And Install Xampp

After installing the package Type your PHP code in some text editor like notepad
Then save the program as somename.php to Htdocs folder ( In windows its default path is C:\xampp\htdocs\ ) 
Then open Browser and goto the address http://localhost/Program_name.php
Now the output will be displayed if their is no errors.
You may create folders in htdocs if you want to access the folder change the path to 
http://localhost/Foldername/Filename.php






Tags : How to compile a php script , How to run php script , how to obtain php scripts output , get php code's output , processing  a php code , how to compile php code  , how to run a php program , how to compile php program

C Program To Add Two Matrices Using Function

 How to add 2 matrix in c

Algorithm for adding 2 matrices

1) Check the sizes of two matrices math A (m×n) and math B (u X v): if m = u and n = u then display a message matrix addition is possible . Otherwise print matrix not possible Exit .

2) Create a new square matrix of size m×n.

3) For each element in A find the element at the same position at B and add the two values.

Main variables

m1,m2 = 2 matrices 2d arrays
n = Result matrix
i,j = Loop controllers
r,r1,c,c1 = Row and Column
Program

#include<stdio.h>
main()
{
int i,j,r,c,r1,c1,m1[50][50],m2[50][50],n[50][50];
void matsum(int[50][50],int,int);
printf("Enter the number of rows and column of 1st matrix\n");
scanf("%d %d",&r,&c);
printf("Enter the elements of matrix 1");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
scanf("%d",&m1[i][j]);
}
}
printf("Enter the number of rows and column of 2nd matrix\n");
scanf("%d %d",&r1,&c1);
printf("Enter the elements of matrix 2");
for(i=0;i<r1;i++)
{
for(j=0;j<c1;j++)
{
scanf("%d",&m2[i][j]);
}
}
if((r1==r)&&(c1==c))
{
for(i=0;i<r;i++)
for(j=0;j<c1;j++)
{
n[i][j]=0;
n[i][j]=m1[i][j]+m2[i][j];
}
matsum(n,r,c1);
}
else
printf("Matrix addition not possible\n");
}
void matsum(int x[50][50],int y,int z)
{
int i,j;
printf("Sum of the matrices is \n");
for(i=0;i<y;i++)
{
for(j=0;j<z;j++)
{
printf("%d",x[i][j]);
printf("\t");
}
printf("\n");
}}

Output

Enter the number of rows and column of 1st matrix
2 2
Enter the elements of matrix
1 1
1 1
Enter the number of rows and column of 2nd matrix
2 2
Enter the elements of matrix
2 2
2 2
Sum of the matrices is
3 3
3 3

C Program To Find Length Of A String

Variables used
a -Array
l -Lenth
i -Loop control


Program


#include<stdio.h>
#include<string.h>
main()
{char a[100];
int i,l=0;
printf("Enter the string");
gets(a);
for(i=0;a[i]!='\0';i++)
{l=l+1;
}
printf("The length=%d",l);
}

C Program To Multiply 2 Matrices

Variables used


i,j -Loop control
m,n,p,q - Row & Column
a,b -Arrays


Program


#include<stdio.h>
main()
{
system("clear");
void mat(int[10][10],int[10][10],int,int,int);
int i,j,m,n,p,q,a[10][10],b[10][10];
printf("Enter The no of rows and column of 1st matrix");
scanf("%d%d",&m,&n);
printf("Enter The no of rows and column of second matrix\n");
scanf("%d%d",&p,&q);
if(n==p)
{
printf("Enter The element of first matrix \n\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
scanf("%d",&a[i][j]);
}
printf("The first matrix is \n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
printf("%d\t",a[i][j]);
printf("\n");
}
printf("Enter The elements of The second metrix\n")
for(i=0;i<p;i++)
{
for(j=0;j<q;j++)
scanf("%d",&b[i][j]);
}
printf("The second matrix is \n");
for(i=0;i<p;i++)
{
for(j=0;j<q;j++)
printf("%d\t",b[i][j]);
printf("\n");
}
mat(a,b,m,n,q);
}
else
printf("Multiplication is not possible\n");
}
void mat(int a[][10],int b[][10],int m,int n,int q)
{
int i,j,k,c[10][10];
for(i=0;i<m;i++)
{
for(j=0;j<q;j++)
{
c[i][j]=0;
for(k=0;k<n;k++)
{
c[i][j]=c[i][j]+(a[i][k]*b[k][j]);
}
}
}
printf("The product of two matrix\n");
for(i=0;i<m;i++)
{
for(j=0;j<q;j++)
printf("%d\t",c[i][j]);
printf("\n");
}
}


Output

Enter The no of rows and column of 1st matrix 2 2
Enter The no of rows and column of second matrix 2 2
Enter The element of first matrix 2 2 2 2
The first matrix is 
2 2
2 2
Enter The elements of The second matrix 2 2 2 2
The second matrix is 
2 2
2 2
The product of two matrix

C Program To Find Factorial Of A Number Using Recursive Function

Factorial(Recursive)


Variables used
num-The number
facto-Factorial


Program
#include<stdio.h>
main()
{
int num ,facto ;
int fact(int);
printf("Enter the Number");
scanf ("%d",&num);
facto=fact(num);
printf("Factorial of Number=%d",facto);
}
int fact(int x)
{
int y;
if(x==1)
return 1;
else
{
y= x * fact(int x-1);
return y;
}
}

C Program To Solve A Quadratic Equation

Variables used
a,b,c-The values of eqn
d-Value to find existance of real root
r1,r2-Roots of eqn


Program


#include<stdio.h>
main()
{
int a,b,c,d ;
float r1,r2;
printf("Enter the values of a b c");
scanf ("%d%d%d",&a,&b,&c);
d=(b*b)-(4*a*c);
if(d==0)
{
printf("The roots are real ,equal");
r1=-b/(2*a);
r2=r1;
printf("Roots are %f%f",r1,r2);
}
if(d>0)
{
printf("The roots are real unequal");
r1=(-b+sqrt(d)/(2*a);
r2=(-b-sqrt(d)/(2*a);
printf("Roots are %f%f",r1,r2);
if(d<0)
{
printf("Roots are imaginary");
}
}


Output


Enter the values of a b c
1 4 4
The roots are real ,equal
Roots are 2 2



C Program To Convert Decimal To Binary Octal And Hexadecimal

Variables used
b,c,d -Array
a -Decimal number
x,y -a
i,j -Loop control
l,k -Limits

Program
#include<stdio.h>
main()
{
system ("clear");
int a,x,y,b[100],c[100],d[100],i=0,k=0,l=0,j,n;
printf("Enter the number\n");
scanf("%d",&a);
x=a;
y=a;
printf("Enterthe choice\n 1.Binary 2.Octal 3.Hexadecimal\n\n");
scanf("%d",&n);
{
switch(n)
{case 1:
while(a>0)
{
b[i]=a%2;
a=a/2;
i++;
}
printf("Binary equalent is \n\n");
for(j=i-1;j>=0;j--)
printf("%d",b[j]);
break;
case 2:
while(x>0)
{
c[k]=x%8;
x=x/8;
k++;
}
printf("Octal equalent is \n\n");
for(j=k-1;j>=0;j--)
printf("%d",c[j]);
break;
case 3:
while(y>0)
{
d[l]=y%16;
y=y/16;
l++;
}
printf("Hexadecimal is \n\n");
for(j=l-1;j>=0;--j)
{
switch(d[j])
{
case 10:printf("A");
break;
case 11:printf("B");
break;
case 12:printf("C");
break;
case 13:printf("D");
break;
case 14:printf("E");
break;
case 15:printf("F");
break;
default:printf("%d",d[j]);


} } } } }

Output


Enter the number 
10
Enterthe choice
1.Binary 2.Octal 3.Hexadecimal
1
Binary equalent is  1010

C Program To Find All Prime Numbers From 1 To Infinite

To Check The Number is Prime or Not


Variables used
i=Loop control
n-Number


Program
#include<stdio.h>
#include<process.h>
main( )
{
int i,n;
printf("Enter the Number");
scanf("%d",&n);
for(i=0;i<=n/2;i++) //Used for small Number only
{
if(n%i==0)
{
printf("The Number is Not Prime");
exit(0);
}
}
printf("The Number is Prime",c);
}

Output
Enter the number 5
The number is prime 
Enter the number 4
The number is Not prime





Tags : C program to find prime numbers , c program to check the given number is prime or not ,c program for prime number , prime or not c program , code for finding the given number is prime or not , free c program for check whether the given number is prime or not

An introduction to PHP - Some Basic HTML tags

<a>
The tag <a> is used for define html links.
Eg : <a href="http://123codings.blogspot.com/">My Blog</a>
http://123codings.blogspot.com/ is the link address ( target address ).My Blog is the text.
Result - My Blog


<b> 
The HTML tag <b> stands for Bold. It gives a bold text.
Eg <b> 123codings </b>
Ordinary text 123codings
Bold text 123codings


<br>
The tag <br> is used for a new line it dont have an end tag like </a> . 
Eg : 1st line<br>2nd line
Result : 
1st line
2nd line


<i>
The tag <i> is used for italics text.

Ordinary text 123codings
Italics text      123codings

<img>
The <img> tag  is used to insert an image on HTML pages.
src =  full address / path of image
Eg : <img src="http://someaddress/somepicturename.image's extension"></img>
        <img src="http://3.bp.blogspot.com/-gSd4vVj7XE/ToE9IN_jLrI/AAAAAAAABuY/Df_MAYwsokY/s1600/123codings.akg.jpg"></img>
Result










Xampp Free Download And Installation

Xampp is developed by http://www.apachefriends.org/ . The package XAMPP means 
X - Cross platform
A - Apache server
M - Mysql 
P - PHP
P - Perl


Download the Xampp Package 


For Linux       - http://www.apachefriends.org/en/xampp-linux.html
For Windows - http://www.apachefriends.org/en/xampp-windows.html


After download the package install it.
Tick all
Install the filezilla as service by clicking ok


Click yes to start filezilla as a service which start with windows otherwise click no
Then Start the server by clicking Yes
Click on Filezilla's Admin  button.




Copy the server address ( 127.0.0.1 )
Open the browser And goto the address http://127.0.0.1 Or http://localhost




Now the installation is completed successfully .....
Select your language.
There are some demonstrations like CD Collection ,Biorhythm,Instant Art,Flash Art etc.
You may Control / Create  Databases at PHPMYADMIN ( http://127.0.0.1/phpmyadmin/ )




Tags : How to install php server in windows , how to install xampp , xampp free download ,php compiler free download ,php server free download for windows xp , windows 7 , windows 8, Free download php server , PHP compiler for free

Saturday, September 10, 2011

C Program Algorithm To Count Number Of Vowels Blank Spaces Words

Program

#include<stdio.h>
#include<string.h>
main()
{
char a[50],b[50];
int i,l,count=0,sp=0;
printf("enter the string:\n");
scanf("%s",b);
l=strlen(b);
for(i=0;i<l;i++)
{
a[i]=toupper(b[i]);
for(i=0;i<l;i++)
{
if(a[i]=='A'||a[i]=='E'||a[i]=='O'||a[i]=='U')
count+1;
else if(a[i]==' ')
sp=sp+1;
}}
printf("Number of vowels in the string=%d ",count+1);
printf("Number of space=%d",sp);
printf("No of word=%d",sp+1);
}

Output
Enter the string
god is great
Number of vowels in the string=4
Number of space=2
No of word=3

C Program For An Exponential Series

Variables used


fact=1,p=1,e=1,x,n,i


Program

#include<stdio.h>
main()
{
int x,n,i;
float fact=1,p=1,e=1;
printf("Enter the values of x & n");
scanf("%d%d",&x,&n);
for(i=1;i<n;i++)
{
p=p*x;
fact=fact*i;
e=e+(p/fact);
}
printf("%f",e);
}

C Program Read Days And Print In Month Week Day Format

Variables used

month-Month
year-Year
day-Day
r-No: days entered
rem-Remainder

Program


#include<stdio.h>
main()
{
int month ,day,year,r,rem;
printf("Enter the number of days");
scanf("%d",&r);
year=r/365;
rem=r%365;
month=rem/30;
day=rem%30;
printf("Year=%d Month=%d Days=%d ",year,month,day);
}

C Program To Implement Bubble Sort

Bubble Sort 

The bubble sort may be notoriously slow, but it's concept is simple in the all sorting
algorithms, so that reason is a good beginning for our exploration of sorting
techniques. 

Algorithm


1. Compare each pair of adjacent elements from the beginning of an array
2. If they are in reversed order, swap them.
3. If at least one swap has been done, repeat steps 1&2

Program

#include<stdio.h> 
main() 

int a[100],i,n,j,tem=0; 
printf("enter the limit"); 
scanf("%d",&n); 
printf("enter the numbers"); 
for(i=0;i<n;i++) 
scanf("%d",&a[i]); 
for(i=0;i<n-1;i++) 
for(j=0;j<n-1-i;j++) 
if(a[j]>a[j+1]) 

tem=a[j]; 
a[j]=a[j+1]; 
a[j+1]=tem; 

printf("sorted array"); 
for(j=0;j<n;j++) 
printf("%d\n",a[j]); 
}

Output

enter the limit 5
enter numbers 2 1 3 5 4
sorted array is
1
2
3
4
5




Tags: C program to implement bubble sort,C program to perform bubble sort ,Bubble sort in c,Free bubble sorting program,bubble sort algorithm,bubble sort flowchart

C Program To Find Sum And Average Of N Numbers

Algorithm
1) Read the limit
2) While n=count
3) Set
sum=sum+x
count+=1
4) Print sum and average


Variables used


n-The limit
count-To check limit
x-Numbers
sum-Sum
avg-Average


Program


#include<stdio.h>
void main()
{
int n,count=1;
float x,avg,sum=0;
printf("Enter the no: of terms");
scanf("%d",&n);
while (count<=n)
{
printf("Enter the number");
scanf("%f",&x);
sum=sum+x;
count+=1;
}
avg=sum/n;
printf("Sum of the n numbers is =%f",sum);
printf("Averege of the n numbers=%f",avg);
}


Output


Enter the no: of terms
3
Enter the number
1
Enter the number
2
Enter the number
3
Sum of the n numbers is =6
Averege of the n numbers=2


Tags : C Program To Find Sum And Average Of N Numbers,flowchart and algorithm  To Find Sum And Average Of N Numbers,c program to find sum of n numbers,c program to find average of n numbers