5.24.2013

What can PHP do?

PHP is server side web scripting language. So it is mainly work on server such as collect form data, generate dynamic page content, or send and receive cookies. 
In summarize we can say that PHP can do the following things:
  • Creating dynamic web pages
  • Collecting form data
  • Send or receive cookie
  • Insert/update records of database
  • Prevent unauthorized access
  • Decode the data(i.e. encrypt)
If we talking the about the filed/area of php working, then php also used in below category:

What is PHP

The PHP stands for PHP Hypertext Preprocessor.
But in past PHP originally stands for Personal Home Page.

PHP is server side scripting language, usually used to create web applications.

PHP is invisible to the end user. So we can say that php has nothing to do with  page design(i.e. layout), events.

In summarize, we can say that "php is an open source source, server-side, HTML-embedded web-scripting language that is compatible with all the major web servers."

To run the php code, we need a server. There are two options to setup the server as:

5.17.2013

Count digit repetition in number range

Q. Write a C program to count the no. of occurences of n's in a given number range.

For example:
random numbers : 45,78,2,65,489,6,2,6,55,9
find out how many times the digit 2 repeat?
2's digit repeat 2 times.

Ans.

/*c program to count the no. of occurences of n's in numbers range*/
#include<stdio.h>
int main()
{
 int arr[10],i,num,r,s,c=0;
 for(i=1; i<=10; i++)
 {
  printf("Enter %d number : ",i);
  scanf("%d"&arr[i]);
 }
 printf("\nEnter search number : ");
 scanf("%d", &s);

5.15.2013

Nested Pyramid

Q. Write a C program to print the following nested pyramid as:

* *** *** *
** ** ** **
*** * * ***

Ans.

/*c program for nested pyramid*/
#include<stdio.h>
int main()
{
 int r,c,num=3,n;
 n=num;
 for(r=1; r<=num; r++,n--)
 {
   for(c=1; c<=r; c++)
       printf("*");
   printf(" ");

Dignal Character Pyramid

Q. Write a C program to print the following character pyramid as:

 a b b b
 b a b b
 b b a b
 b b b a

Ans.

/*c program for alternate character pyramid*/
#include<stdio.h>
int main()
{
 char r,c,ch='d';

Alternate Number Pyramid

Q. Write a C program to print the following double number pyramid as:

1222
2122
2212
2221

Ans.

/*c program for alternate number pyramid*/
#include<stdio.h>
int main()
{
 int r,c,num=4;
 for(r=1; r<=num; r++)
 {
  for(c=1; c<=num; c++)