Latest Post
Showing posts with label C - Programming part 1. Show all posts
Showing posts with label C - Programming part 1. Show all posts

Array - Three Dimensional Array in C Programming

Written By Unknown on Thursday, October 10, 2013 | 7:41 AM

Three Dimensional Array :
We can work with Three Dimensional Array in C- Program.Basically Three Dimensional Arrays are array of an array.Like :
               int table [10][10][10];

If we declare any array like above than compiler will allocate memory for 10*10*10 = 1000 array elements.

Basically more than one of two Dimensional Array makes Three Dimensional Array.Watch the program below :

                                   #include<stdio.h>
                                   #include<conio.h>
                                    main()
                                    {
                                           int i,j,k;
                                           int table [3][4][2] = {
                                                                              {1,2},
                                                                              {3,4},
                                                                              {5,6},
                                                                              {7,8},
                                                                          },
                                                                          {
                                                                               {9,10},
                                                                               {11,12},
                                                                               {13,14},
                                                                               {15,16},
                                                                           },
                                                                           {
                                                                                {17,18},
                                                                                {19,20},
                                                                                {21,22},
                                                                                {23,24},
                                                                            },
                                                                            };
                                                                                for(i=0;i<3;i++)
                                                                            {
                                                                                for(j=0,j<4,j++)
                                                                            {
                                                                                for(k=0;k<2;k++)
                                                                                printf("\n array[%d][%d][%d]=",i,j,k);
                                                                            } /*End for j*/
                                                         } /*End for i*/
                                          getch();
                                       }

Run This Program To See The OUTPUT.

Program Analysis :
-> In this program,Three for loop is used through i,j,k variable.

-> table [][][2]
here a one dimensional array is working including two array element.

-> table [][4][2]
Four One Dimensional Array generated a Two Dimensional Array here.

-> table [3][4][2]
Three Two Dimensional Array generated a Three Dimensional Array here.

Array - Two Dimensional Array in C Programming

Two Dimensional Array :
Two Dimensional Array can be created in C - Program.Sometime it called "matrix".Two Dimensional Array has two subscript or index.The declaration of Two Dimensional Array is :
                 
        Data_Type Array_Name [row] [column]

Here row and column are sizes of these array.EX :
       
        int table [3][2];

The above table is a Two Dimensional Array with 3 rows and 2 columns.

Two Dimensional Array Initialization :
There are many ways to Initialize Two Dimensional Array:Like  :

                                                   int table [4][2]={
                                                                                {1,2},
                                                                                {3,4},
                                                                                {5,6},
                                                                                {7,8},
                                                                            };

We can also initialize it like this      :              int table[4][2]={1,2,3,4,5,6,7,8};

We must mention second index for initializing Two Dimensional Array:EX  :
                                                 
                                                   int table [][2]={1,2,3,4,5,6,7,8};    //correct form


Watch The program :     #include<stdio.h>
                                        #include<conio.h>
                                        #define ROLL 4
                                        #define NUM  2
                                         main()
                                         {
                                               int student [ROLL] [NUM];
                                               int p;
                                               printf("Type Roll And Marks :");
                                               for(p=0;p<=3;p++)
                                          {
                                               scanf("%d%d",&student [p][0],&student [p][1]);
                                           }
                                                for(p=0;p<=3;p++)
                                          {
                                               printf("\n%d%d",student[p][0],student[p][1]);
                                           }
                                               getch();
                                           }
INPUT :         Type Roll And Marks :
                       1
                       2
                       3
                       4
                       5
                       6
                       7
                       8

OUTPUT :       1,2
                        3,4
                        5,6
                        7,8

Hope all of you understand how Two Dimensional Array works.Thank you very much for reading.
                                                 
                 

Basic Discussion And Knowledge Building on "Array"

Array :
Array is a type of variable collector which contain more than one variable with the same name.The way to declare array is as follow :
           Data_Type Array_Name [Size]

Data_Type means what type of array we will work with ( int, char.. etc ).How many variable or element will array contain is declared by the size of array.Like :
         
           int i [5]

Here i is an int type array and this array containing 5 variable or element.Array element starts from zero(0).

              i [0]

Here, i [0] is the first element of i [5] array.


Why We Use Array :
Lets think we will have to find out 30 days temperature individually and at the end of the month we will have to find the average temperature of that month.To do this we must need 30 variables like :

                 int first_day,second_day,third_day.....

but if we do this same task for 365 days than what will we do?Can we declare 365 variables easily?I don't think so....
In this case we can use " array " to compress our program and make it quit easy.

Array Declaration :
We can declare array of any data type.Like :
                                                                 int numb[25];
                                                                 char name[55];
                                                                 float value[20];
                                                                 double price[100];

Assigning Value In Array :
Array element could be used anywhere in the program as like an ordinary variable.Ex :
                                                                 int i [5];
                                                                 i[2] = 10;
                                                                 i[1] = i[2];
Array Initialization :
When array is declared,It can also be initialized too.Like :
                                                                 int numb [5]={1,2,3,4,5};

Watch The Program Carefully :
                                                                 #include<sthio.h>
                                                                 #include<conio.h>
                                                                  main()
                                                                  {
                                                                   static char cloud [] = {'C' ,'L', 'O', 'U', 'D'}
                                                                  int i;
                                                                  for(i=0;i<5;i++)
                                                                  printf("%c",cloud[i]);
                                                                  getch();
                                                                  }

OUTPUT :   CLOUD 

Loop Control Statement in C Programming - " do....while "

Do While Statement :
The value of condition for " do.....while loop " is placed at the end of the loop.Like :

                     do
                          {
                               statement;
                           } while (condition);

Watch the program carefully : 
                            #include<stdio.h>
                            #include<conio.h>
                             main()
                                      {
                                       int i=0;
                                       do
                                      {
                                          printf(" %d ",i);
                                          i++
                                        } while (i<5);
                                        getch();
                                        }
                                           
OUTPUT :

                                               0,1,2,3,4

Program Analysis :
->                                      do
                                          {
                                          printf(" %d ",i);
                                          ................................
                                          ................................
Here the value of i will be shown first.

-> i++;
     }while(i<5);

In this step,the value of i will be increased by 1 and value will be 0 to 1 and in the mean time condition will also be checked.As i<5 so condition will be true and printf function will be executed and 1 will be shown.

-> In this way when the value of i will be 5 than the condition will be false because i can't be equal to 5 according to the condition(i<5).So the loop will end.

Loop Control Statement in C Programming - " while "

While Statement :
While statement is also called while loop.The way to write while statement is :
                                                       
               while (condition)
                        statement;

Here condition is any of True C- Programming Expression.Usually relational expressions used here.While statement calculate the value of condition at first.

If the calculated value of condition become true than while statement will be executed but if the calculated value of condition become false than the statement will not be executed....

Watch the program very carefully :

                                                                 #include<stdio.h>
                                                                 #include<conio.h>
                                                                  main()
                                                                  {
                                                                                     int i;
                                                                                     i=1;
                                                                                     while(i<=10)
                                                                                     {
                                                                                                 printf("%d",i);
                                                                                                 i++;
                                                                                      }
                                                                    getch();
                                                                    }


OUTPUT :
                                         1,2,3,4,5,6,7,8,9,10



Program Analysis :
->i is initialized first of all.i=1

->while(i<=10)
So the first expression is true and body of while will execute.

->Value of i will be printed and i will be increased by 1 so the value of i is now 2.

->again for the value of i is true according to the condition(i<=10)

->So when the value of i will be 11,the condition will be false and while loop will end.

Loop Control Statement in C Programming - " for loop " 2

Written By Unknown on Wednesday, October 9, 2013 | 11:36 PM

Nested for loop :
We can use one or more for loops in between one for loop.This is called nested for loops.Sometime it become very very important to use nested for loop.


For loop variations :

We can initialize more than one variable in to for lop.Like :
                                                           for( i=0, j=0; i<20; i++ )
                                                           for( p=1,q=1; p+q<20; p++,q++ )


We can also initialize variables outside of for loop.Like :
                                                           i=0  //initialization
                                                           for( ; i<20; i++ )


If we need to use increment/decrements outside of for loop than we can do like this :
                                                           i=0
                                                           for(;i<20;)
                                                           {
                                                                 printf("%d",i);
                                                                 i++;    //increment
                                                            }


We can use logical operators too in between conditions like :
                                                           j=0;
                                                           for ( i=0; i<10 && j!90; i++ )

Infinite for loop :
If we need to create an infinite loop we can use for.To create this infinite loop we cannot use initialization,condition and increment into for.Like :
                                                            for( ; ; )
                                                            {
                                                                  printf("\n finite loop \n");
                                                             }

After running this program press Ctrl - Break at a time.

Loop Control Statement - " for Loop " 1

Loop Control :
Sometime we need to do a specific task more than one time.In that case,we don't write that statement again and again.We use loop controlling statement.

In " C " there are three loop controlling statement :
                                               
                                                  1. for
                                               
                                                  2.while
                                               
                                                  3.do.....while

for loop :
To use one or more statement for a selected time in " C " we use " for " loop.

Ex :
I need to print " SHUVO " for 50 times on computer screen.Here,no need to write "printf" for 50 times.We can do it more easily by using " for " loop.

                                                   for(i=1; i<50; i++)
                                                   printf("SHUVO");

The structure of "for loop" is as follow:
                     
                          for(initialization;                    condition;               increment/decrements)
                                     |                                                               |                                         |               |
          Variable and Assignment Operator             <, >, >=, <=, <<, ||                          ++           - -


Initialization :
The starting value of a loop is declared here.Usually,variables and assignment operators( = ) are used here.

Condition :
Here usually used relational expressions.When loop will end,that depends on this conditional section.If the condition become false in this section the program will also be terminated.

Increment :
Declared value of variables in the initialization section turned  incremented or decremented in this section.

Watch The Program :
                                                       #include<stdio.h>
                                                       #include<conio.h>
                                                       main()
                                                       {
                                                        int i=1;
                                                        for(i=1; i<=15; i++)
                                                        Printf("The Value is ?%d",i);
                                                        getch();
                                                        }

OUTPUT:

1,2,3,4,5,6,7,8,9,10,11,12,1315


Program Analysis:
->  for ( i=1; .....; ..... )
This is initialization part in for loop.Here the value of i is declared 1.

-> This is the conditional part.If the condition become satisfied printf() function will execute.So when i=1 and 1 is less than 15,condition is true.

-> for ( .......; .......; i++ )  
After executing printf(), i++ will execute.The loop will be working and value of i will be increasing by one every time until the condition become false.

Decision Control Statement In C Programming - " Ifelse and elseif "

If Else :
We can use “else” with “if” but it is up to us that will we use or not.The way to use else with is as below:

If(expression)
        statement  1;
else
        statement 2;


If the value of “if” expression become true than statement 1 will be execute otherwise statement 2 will execute.

Watch the program carefully :
                                                                    #include<stdio.h>
                                                                    #include<conio.h>
                                                                     main()
                                                                     {
                                                                     int numb;
                                                                     printf("Enter How Much Money do You Have? : ");
                                                                     scanf("%d",&numb);
                                                                     if(numb>50)
                                                                     printf("You are rich");
                                                                     else
                                                                     printf("You are poor");
                                                                     getch();
                                                                     }

Program Analysis:
Here two simple statement and condition are working that if the entered  number  become grater than 50,First statement will excuete otherwise if the number remain under 50 second statement will be published.



Elseif:
We can create “if else if” chain through else if in C Program.The structure is as following:
                                                          If(expression 1)
                                                                   Statement 1;
                                                          Else
                                                                  If(expression 2)
                                                                   Statement 2;

                                                           Else

                                                                   Statement3; 

Decision Control Statement In C Programming - " If "

Written By Unknown on Tuesday, October 8, 2013 | 10:02 AM

If Statement :
If is very important decision control statement in C - Programming.Usual way to write if statement is :

                              If ( expression )
                              statement;

OR :

                              If ( expression )
                              {
                               statement1;
                               statement2;
                               }

First of all "if" evaluate the value of expression.If the value of expression become true than computer will work as the statement says.

If the value of expression become false than statement will not be executed.Usually if - expression works with relational operator ( > , < , >= , <= , == )

Ex :                                           if(p>q)
                                                  printf("p is greater than q");

Watch the program Carefully :
                                                            #include<stdio.h>
                                                            #include<conio.h>
                                                            main()
                                                            {
                                                             int number;
                                                             printf("Enter Your Number :");
                                                             scanf("%d",&number);
                                                             if(number>=33)
                                                             printf("\nYou Pass In The Exam");
                                                             getch();
                                                             }

Program Analysis :
Here if will analyze the value of expression is true or false.If the value of inputted number is greater than or equal 33,the expression will be true and program will run otherwise program will be terminated.

We can use logical operator too with "if" expression.Like:
                                     

                                        #include<stdio.h>
                                        #include<conio.h>
                                        main()
                                        {
                                        int numb;
                                        printf("Enter Your Number :");
                                        scanf("%d",&numb);
                                         if(numb>=61&&numb<=80)
                                        printf("You Got First Division");
                                        if(numb>=45&&numb<=60)
                                         printf("You Got Second Division");
                                         if(numb>=33&&numb<=44)
                                         printf("You Got Third Division");
                                        if(numb>=81&&numb<=100)
                                        printf("You Got Letter Marks");
                                        getch();
                                        }

Operators And Its Classification

Operators :
Operators are some symbol or word in C Program which give instruction to the compiler to do some mathematical or logical task.

EX :                            a+b

Here + is an operator.Data ,Variable and Expression where operator works on is called operand.Like a+b,here a and b is operand.
                           
                                   a              +              b
                                    |               |               |
                           Operand     Operator     Operand

There are different type of operator in C.Like :

                                  * Mathematical Operator
                                            -> Unary Mathematical Operator
                                            -> Binary Mathematical Operator
                                  * Assignment Operator
                                  * Logical Operator
                                  * Relational Operators
                                  * Conditional operators
                                  * Bitwise Operators
                                  * Special Operators

Mathematical Operators : Mathematical Operators are +, -,*,\ etc.
5 binary and 2 unary mathematical operators are available in C.

Binary Operators: It can work with two operand at a time.Binary Operators are :

                                  Addition :                   +
                                  Subtraction :               -
                                  Multiplication :            *
                                  Division :                    /
                                  Reminder/Modulus :   %

Unary operator : It can work with one operand at a time.They are :

                                  Inorement :                ++
                                  Decrement :               --
                                  Unary minus :             -

Assignment Operators : ( = ) is used as assignment operator in C.

Relational Operators : Relational Operators are used to compare two variable in C.Like

                                                                    a < b
There are 6 relational operators in C.They are listed below :
                                                Equal :                              ==
                                                Greater than :                    >
                                                Less than :                         <
                                                Greater than or equal :       >=
                                                Less than or equal :           <=
                                                Not equal :                       ! =

Logical operator : Logical Operators are listed below:
                                   Operator       -           Symbol             -      Example
                                   
                                      AND          -             &&                -      a>b && b>c
                                      OR             -              | |                   -      a>b | |  b>c
                                      NOT          -               !                   -           !a

Conditional Operator : Conditional operator can work with three operand at a time.
EX :                               c = ( a>b ) ? a : b

Constants and Symbolic Constants in C Program

Written By Unknown on Monday, October 7, 2013 | 3:32 PM

Constants :
Constants is a type of value of a program that we can not change after running the program.So the value of constants is unchangeable.

There are two type of Constants in C :

                                                                           Constants
                                                                                  |
                                          1.Literal Constants                      2.Symbolic Constants

1.Literal Constants :
                                           5x^2 + 9y + c = 11;

Here 5 and 9 is literal Constants because when we run the program we can't change the value of 9,5 and 11.

Symbolic Constants :
This type of Constants are declared through a defined name.After running the program these values remain unchangeable.

Ex    :                                  int i = 10;
                                            i = i+1;

There are many kind of symbolic Constants like integer constant,float and double constant,character constant,string constant

Token,Keywords and Identifiers

Token :
When we compile a program,compiler justify the program is correct or not.If there is no syntax error in our program then compiler take the whole program as some token.

Like a language contain a lot of words or symbol,C language also contain some token. Compiler turns those token into computer usable code.

Keywords :
Keywords are some reserved words that compiler can define and work with them.Like char is a keyword.According to ANSI C contain a total number of 32 keywords.

Keyword List :
1.auto                                 11.enum                           21.short
2.break                               12.extern                          22.signed
3.case                                 13.float                             23.sizeof
4.char                                 14.for                                24.static
5.const                                15.goto                             25.struct
6.continue                            16.if                                  26.switch
7.default                              17.int                                 27.typedef
8.do                                    18.long                              28.union
9.double                              19.register                         29.void
10.else                                20.return                            30.while

Identifiers : 
Identifiers are some name which is given to a variable,function or array in a program.

Ex :                              char ch
Here ch is an identifier.

Expression,Statement and Compound Statement

Expression :
Expression is such kind of a program that has its own numeric value as like int a or #define PL etc.Expression is evaluated by assignment ( = )

Variable = Expression

There are two types of expression :
                                        Expression
                                                |
                                  1.Simple Expression
                                  2.Complex Expression

Simple Expression : 
Simple Expressions are made by a single part like variable,constant etc.

                                  Simple Expression          ----          Description


  1.                 Name                                    ----           Variable
  2.                 20                                         ----            Literal Constant
  3.                 MINUTE_PER_HOUR        ----           Symbolic Constant   
Complex Expression :
When a simple expression contain any operator like +,-,% etc then it called complex expression.

Ex : 2+8, x=y+5, x=y=10 etc

Statement :
We know we can give instruction to do something to computer through program.Statement is that type of part of a program where an instruction is given by us to computer.Statement could be one or multiple lined.After each statement we must put semicolon( ; ) to complete that statement except #include and # define.

Ex:                                            a=5+10;
                                                  p=q;

We can use white space,space,tab in statement.Like 
                                                  a=5+10

We can write it like below:
                                                 a         =
                                               
                                                 5

                                                 +

                                                 10;

Compound Statements :
When more then one statement stay in between  two brace " {  } " is called compound statement or block.

Ex :

{
printf("COMPOUND");
printf("STATEMENTS");
printf("EXAMPLE");
}

Fundamental Data Type - Double Type Variable

Double Type Variable :

Double type variable is as like float type variable.8 byte memory will be allowed for double type variable.The highest value for double type variable is 1.7*10^+308 and the lowest value is 1.7*10^-308.

Watch The Program Carefully :

#include<stdio.h>
#include<conio.h>
main()
{
double dl;
clrscr();
dl=123.12;
printf("Value of dl is %e",dl);
dl=1234.12;
printf("\n Value of dl is %e",dl);
getch();
}

OUTPUT : 

Value of dl is 1.231200e+02
Value of dl is 1.234120e+03

Fundamental Data Type - Character Type Variable

Character Type Variable :
We use character in C - Program to declare the variable as a character type variable.If we declare any variable as a character then C Compiler allow 1 byte memory for that variable.

EX :  Char ch;

here ch is declared as a character type variable and ch will get 1 byte memory.The highest value of character type variable is +127 and the lowest value is -128 according to ASCII.

Watch the program carefully :

#include<stdio.h>
#include<conio.h>
main()
{
char ch1,ch2;
clrscr();
ch1='1';
ch2=1;
printf("ch1 is %c",ch1);
printf("\n ch2 is %c",ch2);
getch();
}

OUTPUT :

ch1 is 1
ch2 is 1

Program Analysis :

->char ch1,ch2;
here ch1and ch2 is two individual character type variable,

->ch1='1'
If we need to keep a character into a character type variable then we must keep it into a single quote ( ' ' )
-> %c
If we need to print any character type variable on our computer screen then we must use %c

Fundamental Data Type - Float Type Variable

Written By Unknown on Sunday, October 6, 2013 | 8:03 AM

Float Data Type :
Float data type represent floating - point number like a number containing a decimal point or exponent.If we need to work with 20.02 we must put it in a float type variable.

Compiler keep 4 byte memory for a float type variable.The highest value for a float type variable is 3.4*10^38 and the lowest value is 3.4*10^-38

Watch the program Carefully :

1.#include<stdio.h>
2.#include<conio.h>
3.main()
4.{
5.float fl;
6.fl=1.0000000000                         -> 10 "0"
7.printf("The value of fl is %f",fl);
8.getch();
9.}


OUTPUT :

The value of fl is 1.000000            -> 6 "0"



Program Analysis :

-> Here fl is announced as a float type variable.

-> As fl = 1.0000000000,so the value of fl is fixed

-> In printf we saw %f.It stands for showing the float number value on the computer screen as like %d shows int value.

-> In the output we can see six 0 after decimal because float type variable don't keep more than six digit after decimal.



Fundamental Data Type - int (Integer)

Integer Data Type :
Integer is the first Fundamental Data Types among the four.Integer means whole numbers like 1,5,10,345,1257 etc.The short form of Integer is "int". int type variable is use to express whole numbers in C - Program.It takes 2 byte( 16 bit ) memory in a C - Compiler.

Ex : int i;

Here i is announced as an int type variable.The highest value for an int type variable is
+32767 and the lowest is -32768

Watch the program carefully :

1.#include<stdio.h>
2.#include<conio.h>
3.main()
4.{
5.int i;
6.i=32767;
7.printf("The value of i is %d",i);
8.i=42787;
9.printf("\nNew valu of i is %d",i);
10.getch();
11.}


OUTPUT :

The value of i is 32767
New value of i is -22876

Program Analysis :
As "i" is declared as an int type variable so the highest value of i is 32767 and it is printed in our computer screen as exact but when we put the value of i higher than it can contain so the error occurred and the second value of i is irrelevant.

So we must be conscious when ever we need to work with int type variable and we also keep in our mind the highest and the lowest value of an Integer Type Data.  


Definition And Rules To Write Variables

Definition : A variable is an identifier that represent a single data item like a numerical quantity or a character constant.Watch the program below :

1.#include<stdio.h>
2.#include<conio.h>
3.main()
4.{
5.int a,b,c;
6.char d;


In this program a,b and c are integer type variables and d is a character type variable.So we can easily say a,b and c will represent an integer valued quantity and d will represent a single character.


Rules To Write Variables : A programmer can use a variable name as the way he or she want but it should maintain the format mentioned below :

1. Programmer can use the mixed value of upper case alphabet ( A........Z ),Lower case alphabet ( a......z ) or Underscore ( _ ) to write a variable.

2.Variable name must start with an alphabet like ( A.....Z ) or ( a....z ).Some compiler also support underscore( _ ) first.

3.According to ANSI a variable name could contain up to 31 Character.

4.We can not use C-Keyword as a variable name.

5.Uppercase ( A.....Z ) and Lowercase ( a.....z ) are different in "C" so here "Sum" and "sum" are two different variable.

6.We can't place any "White Space" in a variable name like "SHU VO".It wll be "SHUVO"


Examples : 

Valid Variable Names :
                                       1.Shuvo
                                       2.S11
                                       3.SHAKHAWAT
                                       4.A_H_A_M_E_D

Invalid Variable Names:
                                      1.sh uvo
                                      2.0 43
                                      3.[ABC]
                                      4.(Ahamed)
                                      5.%S
                                      6.#shakhawat#

NOTE : 
Some character we can't use as a variable name like #, (, {, [ etc.

Introduction Of C Programming And The History

Written By Unknown on Saturday, October 5, 2013 | 9:15 AM

C may be a general language that has been closely related to the UNIX system OS that it absolutely was developed - since the system and most of the programs that run it area unit written in C.

Many of the vital concepts of C stem from the language BCPL, developed by Martin literary critic. The influence of BCPL on C proceeded indirectly through the language B, that was written by Ken Thompson in 1970 at Bell Labs, for the primary UNIX system on a DEC PDP-7. BCPL and B area unit \"type less\" languages whereas C provides a spread of information sorts.



Dennis Ritchie writes C In 1972 at Bell Labs  and in 1978 the publication of The C artificial language by Kernighan & Ritchie caused a revolution within the computing world.

In 1983, the yank National Standards Institute (ANSI) established a committee to supply a contemporary, comprehensive definition of C. The ensuing definition, the ANSI commonplace, or \"ANSI C\", was completed late 1988.

Understanding C Program - Basic 1

This is an introductory program and from here we are going to learn A,B,C of a C Program.....

Program 1 :

#include<stdio.h>
#include<conio.h>
main()
{
Printf(“Hello Shakhawat ”);
}

OUT PUT : Hello Shakhawat


Program Analysis:

include<stdio.h> : It is a “preprosseor directive” always start from “#” and “stdio.h” is Standert Input/Output Header File.It Contains the details of “printf” file.If we use Printf(“”) in any program then we must write # include<stdio.h>

include<conio.h> : If we use clrscr() and getch() in any program then we must use #include<conio.h>.It is also a header file.

main() : We must use our every C programming fungtion into this “main()” fungtion.”()” This is called parentheses always stand after main.We don’t use semicolon after main() because main() is not an indivisual instraction or statement.Every instructions and statements works under main() fungtion.

{} : These are called brace.Left one is left brace “{“ and the right one is Right brace “}”.



printf() : To print something to our computer screen we will have to use printf().(“”) : this is called Double Quotes.It is used to print something in between (“………..”).

;  : It is called semicolon.We must use this after every instruction.Every instruction + semicolon is called statement.


Program 2 : New Line Creation

#include<stdio.h>
#include<conio.h>
main()
{
printf(“saad\nsayem\nshuvo”);
getch();
}

OUTPUT :  saad
                   sayem
                   shuvo


Program Analysis:

\n : It is a new line creator.We can use it into double quate(“………”).If we write something after \n,it will print in a new line after first line.Please follow the OUTPUT.

getch() :  getch() is related to conio.h headerfile.It will show and get the output on computer screen.

CONFUSE??

CONFUSE??
 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. Learn Programming - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger| Distributed by Rocking Templates