Recent Posts

Tuesday 11 December 2018

String function

In the previous post we learn about what is String.we know that string is a collection of two or more characters.In string we can store alphabet, digit and special symbols.

In this post we will learn what are the string functions.

String functions:

1.strcpy ( ):
This function is used to copy the source string into target string.
Syntax: strcpy(target string, source string);
Example:

void main()

{
char stirng1[10],string[20];

clrscr();

printf("type first stirng");

scanf("%s",string1);

strcpy(string2,string1);

printf("second string=%s",string2");

}


Output:
type first string: programming
second string: programming

2.strlen ( ):
This function is used to find out the length of the string.
Syntax: strlen(string name);

3.strcmp ( );
This function is used to compare two strings.if both values are equal then it will return zero.if first string is greater than second string it return value greater than zero.if the value is less than zero then it is case sensitive.
Syntax: strcmp(string1,string2);

4.strcat():
This function appends means add second string at the end of first string.

Syntax: strcat(string1,string2);

5.strrev():
This function reverse contents of the given string and store it again in the same variable.
Syntax: strrev(string);


Saturday 8 December 2018

Program to get 1 string input and print it.

String:

String is a collection of two or more characters.
In the previous post we learn about what is string.and How it can be print.

Program to get one string input and print it.

#include<stdio.h>
#include<conio.h>
void main()
{
char text[50];
clrscr();
printf("type string");
scanf("%s",&text);
printf("string is = %s",text);
getch();
}


Explanation:

1. Void main():
This is the first statement of every 'C' program,without main() function 'C' program cannot be start.If we didn't include main() function in 'C' program then error will be occurred.so every 'C' program must start with main() function.

2.char:
Char is a data type which is used for print the string.

3.Clrscr();
This is the clrscr() function.This function is used to clear the screen.This function is used to clear the output of the previous output window.

4.Printf():
Printf is a function which used to print any text or value on the screen.The text you want to print is enclosed in  double quote.you can see the below example:
                                   printf ("Hello world");
in the above example hello world will be printed.

5.getch();
This function is used to hold the output window.otherwise when you run your code it will display the output window just for a second so it is necessary to use it in our program.If we want to hold our  output screen.




Friday 7 December 2018

What is String

String:

  1. String is a collection of two or more characters.
  2. In string we can store alphabets digits and special symbols.
  3. when we declare array of character type then it is called as string.
  4. In C, character type array is used to store a string.

Declaration of String:
The declaration of string is similar like Array.
for declaring string we need to specify its size means maximum of how many characters we have to store in string.

Syntax: char string[size];
Example: char str[20];

Here we declare a string variable str of size 20 means variable 'str' characters.

Initialization of String:
while declaring string we can also initialize some value at the time of declaration.

Syntax: char string[size]="text";
Example: char str[20]="programmingsolution";

Here we declare a string variable 'str' of size 20 and assign programmingsolution to it.

Inputting string:

To input the content in the string two function used as 'scanf()' and 'gets()'.
In 'scanf()' function spaces are not allowed in a string.if we give space then the remaining part will be truncated from string.
In 'gets()' function spaces are allowed in a string.

Syntax:    scanf("%s",string_variable);
                 gets(string_variable);
Example: scanf("%s",str);
                 gets(str); 


Monday 17 September 2018

what is WWW

In the previous post we learn about what is Web Browser and in this post we will learn What is WWW and What is the use of WWW.

WHAT IS WWW:

WWW is stand for world wide web.it is the universe of hypertext servers (HTTP servers) which are the servers that allow text, graphics, audio, video, sound file to be mixed together.The world wide web is a hypertext based system providing a uniform, user friendly interface for finding and accessing internet resources.

The world wide web is abbreviated as www or web is an information resource where documents and other web resources are identified by Uniform Resource Locators (URLs) that can be access by the internet.

WHAT IS THE USE OF WWW:

In 1980, a scientist developed programming language called as hypertext markup language (HTML). The program in which we write in this language is called as web page.Early web pages contain only textual information.but nowadays because of advanced technology web pages can contain audio, video, text, graphics, animation, sound and colors etc.by using the internet we can send the information receive the information or share the information from different computers of different networks from any place.

The WWW is  a series of documents called as web pages developed using HTML and which can be accessed  by using the internet with the help of web browser.We can say that the WWW is a market place.WWW is also called as W3.The WWW and HTTP allow to call the link from one page to another page that page may contain  audio, video etc and textual information.

Thursday 9 August 2018

How to create table in HTML

In this post we will learn how to create a table in html in the previous post we already discuss about
What is table tag in html and in this tutorial we will learn how to create table iin html. html is the web based programming language.

For creating table we need to know what is <table> table tag and what is <td> and <th> tag in html.


<TR>:
  1. <TR> tag is a table row.
  2. <TR> table row tag is a paired tag.
  3. <TR> table row tag starts with <TR> and end with <TR>.
  4. <TR> table row tag is used for creating a row in a table.
  5. <TR> table row contain more than one <TD> table data and <TH> table heading tag.
<TH>:


  1. <TH> tag is used for table heading.
  2. <TH> table heading tag is a paired tag.
  3. <TH> table heading tag is start with <TH> and end with </TH>.
  4. By default the text written in <TH> table heading tag is in bold format.  

<TD>:

  1. <TD> is a table data tag.
  2. <TD> tag is used for creating standard cell in table.
  3. <TD> table data tag is a paired tag.
  4. <TD> table data tag is start with <TD> and end with </TD>.
Below is the source code of the table


<table>
<tbody>
<tr>
<th>Name</th>
<th>Student id</th>
</tr>
<tr>
<td>rehan</td>
<td>111</td>
</tr>
<tr>
<td>raj</td>
<td>232</td>
</tr>
<tr>
<td>rohit</td>
<td>2</td>
</tr>
<tr>
<td>khan</td>
<td>222</td>
</tr>
<tr>
<td>rahul</td>
<td>333</td>
</tr>
</tbody></table>

Output:

Name Student id
rehan 111
raj 232
rohit 2
khan 222
rahul 333

Tuesday 7 August 2018

What is table tag in HTML

Table tag in html is the important part in HTML.In this post we will learn what is table tag in html and attributes of table tag in html.

What is table tag in html:


  1. Table tag is used to create a table in html.
  2. Table tag is a paired tag that start with <TABLE> and </TABLE>.
  3. Table tag in html start with <TABLE> and end with </TABLE>
  4. Table tag in html display the data in a table format instead of paragraph or other block level structure.
  5. With the help of table tag in html we can show data in the rows and columns.
  6. When the data is displayed in rows and columns it is easy to read.

Attributes of table tag :

Following are the attributes of table tag in html.

1.WIDTH:
This attribute is used to specify the width of the table and it is specified in terms of pixels.

Example:
<table width="5"> or <table width="50%">

2.ALIGN:
This attribute is used to specify the horizontal alignment of the table.

Example:
<table align="right">
<table align="left">
<table align="center">

3.BORDER:
This attribute is used to specify the border of the table.By default there is no border to the table.

Example:
<table border="2">

4.BORDER COLOR:
This attribute is used to specify the color to the border to the table.

Example:
<table border color="red">

5.BORDERCOLORDARK:
This attribute is used to apply dark color to the border.

Example:
<table bordercolordark="blue">

6.BORDERCOLORLIGHT:
This attribute is used to apply the light color to the border.

Example:
<table bordercolorlight="blue">

7.BGCOLOR:
This attribute is used to apply the background color of the table.

Example:
<table bgcolor="magenta">

8.BACKGROUND:
This attribute is used for displaying image as a background of table.

Example:
<table background="c:\pic.jpg">

9.CELLSPACING:
This attribute is used to provide the space between the cells of the table.It is in terms of pixels.

Example:
<table cellspacing="50">


10.CELLPADDING:
This attribute is used to provide the distance between the cell border and the cell data.

Example:
<table cellpadding="1">

I hope you will understand what is table tag in html.and in the next post we will learn how to use table tag in html and how to create table in html.


Sunday 5 August 2018

What is marquee tag

Marquee is a tag in HTML.For using Marquee tag in HTML we need to know what is Marquee tag and how to use Marquee tag in HTML.
HTML Language is used for creating web pages for the world wide web.
In HTML a block of text is surrounded with tags.


In this post we will learn What is marquee tag and How to use marquee tag in HTML.
In the previous post we learn How to add background image in HTML.and in

What is marquee tag:

Marquee tag is a paired tag that start with <MARQUEE> and ends with </MARQUEE>.
This tag scrolls the text enclosed in between <MARQUEE> and </MARQUEE> tag within a document.
A marquee tag is used to scroll the text either in horizontally or vertically on web page depending on the setting.

syntax:
<MARQUEE ATTRIBUTE NAME="ATTRIBUTE VALUE">
                TEXT WRITE HERE...OR IMAGE......
</MARQUEE>

Attributes of marquee tag are as follows:

1.Behavior:
This attribute indicate the type of scrolling Behavior=scroll scrolls text from one side of the marquee to across or opposite side.
Behavior=slide scrolls text from one side of the marquee across and stops when the text reaches the opposite side.
Behavior=alternate bounces the marquee text from one side to other.

Example: 

<marquee behavior=slide>
      theprogrammingsolution
</marquee>

2.BGCOLOR:
This attribute specify the background color of the marquee.

Example:

<marquee bgcolor=red>
      theprogrammingsolution
</marquee>

3.Direction:
This attribute specify the direction in which the marquee text scrolls.
the possible values are LEFT and RIGHT.

Example:

<marquee direction=right>
      theprogrammingsolution
</marquee>

4.Height:
This attribute is used to specify the height of the marquee in vertical dimension.

Example:

<marquee height=200>
      theprogrammingsolution
</marquee>

5.width:
This attribute specifies the width of the marquee in horizontal dimension.

Example:

<marquee width=200>
      theprogrammingsolution
</marquee>

6.hspace:
This attribute specify the size of the margin to the left and right side of the marquee.

Example:

<marquee hspace=22>
      theprogrammingsolution
</marquee>

7.vspace:
This attribute specify the size of the margin from top and bottom side of the marquee.

Example:

<marquee vspace=22>
      theprogrammingsolution
</marquee>

Below is the code for marquee tag:

<html>

   <head>
      <title>Programming solution</title>
   </head>
 
   <body>
      <marquee>theprogramming solution</marquee>
   </body>
 
</html>
Output:
theprogramming solution


So in the above post we learn what is marquee tag and how to use marquee tag in html.I hope you will understand the marquee tag.

Tuesday 31 July 2018

How to print pattern in C

In the previous post we learn about Program for palindrome number in C and Sum of digits in C and in this post we will learn how to create pyramid, half of pyramid and patterns using *

We can create pyramid, half pyramid and patterns by using loops if, if else.
you need to have the basic knowledge of loops if...else ,while, do while, continue and break.

Program to print patterns and pyramids and half pyramids :

1.Program to print half pyramid print using * :


#include <stdio.h>

#include <conio.h>

int main()

{

    int i, j, r;

   for(i=1; i<=5; i++)

    {

        for(j=1; j<=i; j++)

        {

            printf("* ");

        }

        printf("\n");

    }

    return 0;

}

Output:
*
**
***
****
*****
















Monday 30 July 2018

Sum of digits in C

In the previous post we learn about What is palindrome number and How to write a program  for palindrome number.

In this post we will learn how to write a program for sum of digits in C.
Sum of digits means addition of two or more than two numbers for example number 456 will be 15.

456
4+5+6=15

Program for Sum of digits:




#include <stdio.h>

#include <conio.h>

int main()

{

    int n, num, rem, sum=0;

clrscr();

        printf("Enter number");

        scanf("%d",&num);

        while(num>0)

        {

        rem=num%10;

        sum=sum+rem;

        num=num/10;

}

    

    printf("sum of digit=%d",sum);

    getch();

}


Output:
  Enter number: 456
  Sum of digit: 15

Palindrome number in C


Here we will see what is palindrome number and how to write a program for palindrome number.

Palindrome number in C:

A palindrome number that remains the same when its digits are reversed like 323.



Below is the program for palindrome number:



#include <stdio.h>

#include <conio.h>



void main()

{

    int n,num,rem,sum=0;

    clrscr();

    printf("Enter number");

    scanf("%d", &num);

    n=num;

    while (num>0)

    {

        rem=num%10;

        sum=(sum*10) + rem;

        num=num/10;

    }

    if (n==sum)

    printf ("palindrome number");

    else 

    printf ("not palindrome number");

    getch();

}


Output:
 Enter number:313

palindrome number

Sunday 4 February 2018

2d array in C

In the previous post we learn about what is array and what is one dimensional array.In this post we will learn what is two dimensional array.

What is Array:

  • Array is a collection of similar type of data type.
  • Array is used to store more than one values of same data type under a single variable name in a continuous memory location.

What is two dimensional Array:

  1. Two dimensional array consist of number of rows and number of columns.
  2. Each row consist of specified number of columns.
  3. For accessing element in two dimensional array we have to provide array name followed by row number and column number.
  4. If we skip the column number then specified row number and first column that is zero index value is accessed.
  5. If we skip both column and row then first row (index zero) and first column (index zero) value is accessed.

How to declare two dimensional Array:              

  1. To declaring two dimensional array we have to write data type followed by followed by array name followed by total number of rows and followed by total number of columns in each row.
  2. Row and column numbers are specified in separate square brackets ([ ]).
Syntax: Data type Array name [row][column];
Example:int num[5][5];


How to initialize two dimensional Array:

  1. We can assign the values to array elements at the time of declaration of array.
  2. Each rows values are enclosed within separate inner parenthesis and two values are separated by comma (,).
Syntax: data type arrayname [row][column]={0th row elements}
                                                                         {1st row elements}
                                                                          .....
                                                                          };
Example: int num [5][5]={{1,2,3,4,5},{2,4,6,7,8},{5,6,7,8,9,}};

   

Followers

Popular Posts

Categories

social media

Text Widget

Powered by Blogger.

About Me

My name is junaid khan and i am a full time blogger and author of a blog tutorial called tutorialpointsolution.

String function

In the previous post we learn about what is String .we know that string is a collection of two or more characters.In string we can store al...

Search This Blog

Technology

Adbox

Recent Post

Breaking

Recent In Internet

Comments

Facebook

Pages

Comments

Pages

Recent

Pages

Technology