Tuesday, December 30, 2008

Switch

Switch statement-
A switch statement is used in the similar way as the if …else if….statement. If there are certain number of conditions which are known then the switch statement is used. The conditions are given in the statement itself. The statement in the switch statement is executed when the condition is satisfied. The form of the statement is
Switch(x)
{
Case 1:
…..
…..
Break;
Case 2:
……
…….
Break;
Case 3:
..
..
..
Default:
….
}
The value of x is the value of the number after the case i.e.1,2,3,……
The break statement is used to go out of the switch because if it is not given then the consecutive statements after the executed statement are executed. At last the default statement is given so if the above statements are not satisfied then the default statement is executed. It is not necessary to give the default statement. The control exits from the switch statement if the condition is not satisfied.
e.g.
void main()
{
Int x;
Printf(“Enter the number less than 5”);
Scanf(“%d”,&x);
Switch(x)
{
Case 0:
Printf(“zero”);
Break;
Case 1:
Printf(“one”);
Break;
Case 2:
Printf(“two”);
Break;
Case 3:
Printf(“three”);
Break;
Case 4:
Printf(“four”);
Break;
Default:
Printf(“number is greater than or equal to five”);
}
In this program the number of cases can be increased. The statements in the cases can be of any number. There is no need of the default statement. The ‘exit()’ statement can be used in this program if a another loop is present outside the switch statement. The function can be written in the cases.
e.g.
void main()
{
int x;
do
{
printf(“enter the value”);
scanf(“%d”,&x);
switch(x)
{
Case 1:
…..
Case 2:
…..
..
..

Case 6:
Exit();
}
}while(x!=6);
In this program when user gives the value six the control exits from the program.

Monday, December 29, 2008

Jump statement

GOTO statement-
A other type of statement is the ‘goto’ statement. This statement is used to jump to a position in a program. This statement takes the control to the position given in the ‘goto’ statement. The use of this statement is avoided or it is never used. This is because the statement takes the control to other position which can be tedious. Due to this the understanding of the program becomes difficult to other person reading it. It is advised not to use this statement.
e.g.
void main()
{
Int x,y;
L: Printf(“Enter number greater than 5”);
Scanf(“%d”,&x);
If(x<=y)
{
Printf(“The number is not valid”);
Goto L;
}
else
{
Printf(“the number is %d”,x);
}
Getch();
}
In this program if the condition is not satisfied then the control will go again to the starting of the program otherwise it will print the number and exit.
Break statement-
This statement is used to break the loop i.e. it takes the control out of the loop. The statement is used to jump out of the loop when a condition is not satisfied.
This statement is normally used in the switch statement. The use of break is very essential in the switch statement.
Eg.
Void main()
{
Int x;
For(x=0;x<10;x++)
{
Printf(“%d”,x)
If(x==5)
Break;
}
Getch();
}
In the above program the ‘for’ loop continues its function of printing and incrementing and it also checks if x is five or not. When it reaches five it jumps out of the loop due to the break statement. It doesnot take the control out of the program.
Exit() statement-
This statement has similar function as the break statement but the difference is that it takes the control out of the program. It jumps out of the program when the condition is satisfied.
e.g.
void main()
{
Int x,y;
Y=3;
For(x=0;x<5;x++)
{
Printf(“%d”,x);
If(x==y)
Exit();
}
Getch();
}
In the above program when x and y become equal the program exits. i.e. when x becomes three program exits.
Continue statement-
The continue statement takes the control of the program to the beginning of the loop. Hence it is used in continuous loops where it is necessary to repeat the loop.
e.g.
void main()
{
Int x.y;
For(x=0;;x++)
{
Printf(“%d”,x);
If(x!=6)
Continue;
}
Getch();
}
In the program the ‘continue’ statement gives the condition upto which number the loop should continue.
Return statement-
The return statement is used mainly in the function which will be seen further. It is used to take the control out of the function to the main program. It can be assigned a value which can be returned to the main program. The function for example calculates a value. This value is taken to the main program by the return statement.
e.g. return x;
int xyz()
{
……
……
Return x;
}
void main(0
{
Int x;
…..
…..
Int xyz();
}
In the above example the function returns the value of x. the return statement is used in the function which has a return type. It is not used in the function with return type void.

Friday, December 26, 2008

Operators-

1. Assignment operators-
The general form of this operator is
variable name=expression;
e.g. x=4;
Here the value 4 is assigned to the variable x. The variable can be assigned the value of other variable.
e.g. x=y;
Or x=x+1;
Type conversion-
We cannot convert integer to float or character to integer. For this type conversion is necessary.
It is assignment of a value to a variable of other datatype.
e.g. int x; char y;
x=(int)y;
Here in this example the value of y is converted to integer and then it is stored to x;

Multiple assignment-
In multiple assignment more than two assignments are done. Type conversion can be used.
e.g. int x,y,z;
x=y=z=4;
e.g.
void main()
{
Int x,y,z;
Char l;
Z=2
Y=5;
L=’a’;
X=z;
Printf(“%d%d%d”,x,y,z);
Y=x=z=0
Printf(“%d%d%d”,x,y,z);
X=(int)l;
Printf(“%d”,x);
Getch();
}
o/p-
first printf-252
second printf-000
third printf-97

2. Arithmetic operators-
The arithmetic operators are +,-,*,/. These are used for arithmetic operations.
e.g. int x,y,z;
x=y+z;
x=y-z;
x=y*z;
x=y/z;
y and z are initialized as per the need.

Increment and Decrement-
Increment- ++. This is used to increment the value of variable which has an initial value.
Decrement- --. This is used to decrement the value of variable which has an initial value.
X=0;
X++;
Y=1;
y--;
e.g.
void main()
{
Int x,y;
X=5;
Y=7;
Printf(“%d%d”,x.y);
X++;
y--;
Printf(“%d%d”,x.y);
Getch();
}
o/p-
first printf-57
second printf-65

3. Relational operators-
>- Greater than.
>=- Greater than or equal.
<- Less than.
<=- Less than or equal.
==- Equal.
!=- Not equal.
These relational operators are used in condition statements to check the conditions.
e.g. if(x > y)
if(x <= z)
if(x == y)
do
{
}while(y != 4);

4. Logical operators-
&&- And.
||- Or.
!- Not.
These operators work similarly as they are used in grammar.
e.g. if(x > y && y < z)
if(x < y || y > z)
if(!x < y && y < z)

Tuesday, December 23, 2008

Condition Statement

Decision statement:-
The decision statement is the statement which is used to take certain decisions.
The general statement used is ‘IF’ statement. General form of this statement is
If(condition)
Execute the statement.
The other form is
If(condition)
Execute this statement
Else
Execute the other statement
The operators used in ‘IF’ statement are as follows:-
Let a & b be the statements for checking the conditions.

a= =b: - a equal to b
a! =b: - a not equal to b
a> b: - a greater than b
a< b: - a less than b
a<= b: - a less than or equal to b
a>= b: - a greater than or equal to b

‘If’ condition may contain other if conditions in it. Other ‘else if’ condition can also be used. i.e after if condition ‘else’ is used and if there is a condition other than the first condition then the ‘else if’ condition is used
For the other condition and at last else statement is used for the rest of the conditions.
We will see an example.

void main ()
{
Int x,y,z;
Printf(“Enter the mark of first subjects“);
Scanf(“%d”,&x);
Printf(“Enter the mark of second subject”);
Scanf(“%d”,&y);
If(x>y)
Printf(“x is greater than y”);
Else
Printf(“y is greater than x”);
Getch();
}
In the above program the marks of two subjects is taken. Then the greater number is calculated. Then it is displayed.
The other thing is that an else statement can have a ‘if’ or if…else statement.
Instead of using only a ‘if’ statement in a ‘else’ statement we can use a ‘else if’ statement. Condition should be given in the if statement as above.
Eg. If
Statement
Else if(condition)
Statement
Else if(condition)
Statement
Else
We can give a number of ‘else if’ statement .
Eg.
Void main()
{
Int x[2],y;
Printf(“Enter 2 values”);
For(y=0;y<2;y++)
{
Scanf(“%d”,&x[y]);
}
If(x == y)
{
printf(“X is equal to y”);
}
Else if(x < y)
{
Printf(“X is less than Y”);
}
Else
{
Printf(“Y is less than X”);
}
Getch();
}

Sunday, December 21, 2008

2D,3D Array

Two dimension array-
The two dimension array is similar to single dimension arrays in some aspects. The representation is different. More number can be stored in this array.
Representation- x 1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
In this array there are five rows and five columns. Hence it is declared as x[5][5]. The numbers are stored in order as x[0][0],x[0][1]…..x[0][4]. Then next column x[1][0]…..this continuous upto x[4][4]. This is because the index starts from zero.
Eg.
Void main()
{
Int x[2][2],y,z;
Printf(“Enter 4 numbers”);
For(y=0;y<2;y++)
{
For(z=0;z<2;z++)
{
Scanf(“%d”,&x[y][z]);
}
}
Getch();
}
In the above program first the first for loop is fired. It takes the value of y as 0. Then the control enters the second for loop. The second for loop is executed 2 times upto z<2. Then it exits. The control again goes to the first loop. It increments the value of y. then again the second for loop is called. This continues till the first for loop exits.
Multidimensional array –
In multidimensional array everything is same as that of the two dimensional array but there are many two and one dimensional array in it.
Eg.x[2][2][2][2]

Thursday, December 18, 2008

Arrays in C

Arrays-
This concept is used to to store group of data. If many variables are to be accepted then arrays are used. Arrays are used because for accepting many variables that many variables should be declared. This is not convenient. The arrays are similar to arrays in mathematics inpresentation. There are three types of arrays.
1. Single dimension arrays.
2. Two dimension arrays.
3. Multi dimension arrays.
Let us see first the declaration of array. We will see how single dimension arrays are defined. Similarly the two and three dimension arrays are used.
1. Declaration of single dimension array-
Integer array-int x[5] In this array five integers can be stored.
Character array-char x[5] In this array five charactgers or a word of five characters can be stored. It can be accessed using %s.
Float array-float x[5] In this array five float i.e decimal values can be stored.
Representation-x[1 2 3 4 5]
The numbers in are examples.
Double x[5] In this array five float can be stored.
Eg.
Void main()
{
Int x[5],y;
Printf(“Enter five numbers”);
For(y=0;y<5;y++)
{
Scanf(“%d”,&x[y]);
}
getch();
}
In this example array of five integers is declared. Firstly the printf statement will be executed. Then for loop executes. The concept of loop will be discussed later. Assume that for loop is used to accept values from user. By using the loop the five values entered by user are stored in the array which can be used. Similarly the array of Float and characters can be used.

Monday, December 15, 2008

nested loop

Nested loops-
Loops in loop is called as nested loop. A loop can be written in another loop. For example a for loop may contain another for loop which may again contain other for loops. The other loop can contain similar form.
Eg.
Void main()
{
Int x[2][2],y,z;
For(y=0;y<2;y++)
{
For(z=0;z<2;z++)
{
Scanf(“%d”,&x[y][z]);
}
}
Getch();
}
In the above program there are two for loops. The first for loop is for the row of the array and second for the column. When the first column is finished ie. When the second for loop is finished the loop ends. Then the first loop start for its second number. This again takes the control to the second loop which is again activated. This continuous till the outer loop exits. The nesting may have many for loops in it. The multi dimensional arrays need many nested for loop for storing values it it. For the nested loop the brackets are necessary for continuing the outside loop.the inner most loop continuous until the outer loop exits.
In the similar way the while loop may also contain a another while loop and a do…while may contain other do…while statements.
A for loop may also contain a while loop or a do while loop.

Saturday, December 13, 2008

Loops

While loop-
The while loop only has a condition in it. It doesn’t have the initialization in it and also it dosen’t have incement or decrement statement. The increment or decrement statement can be given in the body of the loop. Initialization of variable which is used in the loop to give condition is necessary.
Eg.while(x<5){ }
Eg.
Void main()
{
Int x=0;
While(x<5)
{
Printf(“Hello”);
X++;
}
Getch();
}
In this program x is initialized to zero. Then the command enters the while loop. Then it checks the condition whether x is less than 5 or not. Then it executes the statement in the loop if the condition is satisfied or else it exits. Hence in this loop the statement in the loop executes only if the condition is satisfied. In this program the condition is satisfied five times. The word hello will be displayed five times. No semicolon is given after the while statement.
Do…while loop-
In the do…while loop the do statement is written at the beginning of the loop and the while statement is given at the end of the loop. Only the condition is given in the while statement as the while statement given above.the initialization of variable is given at the beginning and increment or decrement in the body of the loop. This loop executes the statement once and then checks the condition and then decides whether to run the loop or exit. This is the advantage of this loop that it executes the statement in it atleast once.
Eg do
{
Statement.
}while(condition );
Eg.
Void main()
{
Int x=0;
Do
{
Printf(“hello”);
X++;
}while(x<5);
Getch();
}
In this program first the print statement is executed. Then x is incremented and then the condition si checked whether x is less then five or not. If the condition satisfies then the loop is executed again else it exits.

Friday, December 12, 2008

for loop

LOOPS:
These loops are used to execute a statement number of times until the given condition is satisfied.
There are three types of loops.
1. For loop.
2. While loop.
3. Do..while loop.
1.For loop-
This loop is used very frequently in accepting the values in the array. By using the loop we can execute a statement number of times as per the requirement. The limitation and incrementing or decrementing can also be given in the syntax of the loop. The initialization of variable can be given.
e.g for(x=0;x<10;x++) or for(x=0;x>10;x--)
void main()
{
Int x[5],y;
Printf(“Enter five numbers”);
For(y=0;y<5;y++)
{
Scanf(“%d”,&x[y]);
}
Getch();
}
Here in this program five integers can be stored in the array. To accept the numbers ‘for’ loop is used. First y is initialized to zero. So first value accepted will be stored in x[0], then y will be incremented and the limit is checked weather y is less than 5 or not. Then next value is accepted in x[1]. This is continued upto x[4]. Then when the value of y exceeds the limit the loop exits ending the program. In the starting itself the condition is checked. The declaration of variable used in the loop should be in the beginning of the program. The loop can be used in any manner.
Other forms of for loop-
For(;x<5;)- Only condition is given. Declaration can be in the beginning and incrementing in the loop itself.
For(x=0;x++)- Condition in the loop.
For(;x<5;x++)- definition at the beginning.
For(;;)-definition at beginning, condition and increment or decrement in the body of loop.
Note that the semicolons in the loop are necessary. No semicolon should be given after the ‘for’ loop otherwise the loop will terminate with only once executing the statement inside it.

Wednesday, December 10, 2008

Hi,
I'm an IT engineering student. Here i have some easy points on c language & some part on data structure using C.
---------------------------------------------------------------------
C language:-
All things in this are based on windows platform.
To perform this program u have to install turbo c/c++.
Then in bin folder double-click on tc.
click on file and click new.
Then start typing the program.
Note that the instructions should be in either upper or lower case.
So first let me give u a simple program & then explain the terms.
************************************************************************
#include"stdio.h"
#include"conio.h"
void main()
{
printf("Hello world");
getch();
}

O/P=Hello world
************************************************************************
include:-This means including the file from the include folder which contains the information of the words in angular bracket. in any case this means the same.
#:-This is to differentiate the include files.
" ":-This is the way in which the include files are represented. This can also be represented as < >.
"" searches the header file everywhere on the
.h:-Extension of the header file.
stdio:-This means standard input & output.
conio:-This means console input output.
void:-This means there is no return type for main. Now it will be better to assume that this is a must component. The meaning of this will be understood on way.
main:-This is the main part which is compulsory in all the programmes.
{}:-The program is enclosed in the curly brackets. These are necessary.
printf:-This is the output instruction.
(""):-This is are the must after the instruction to differentiate the output from other instruction.
;:-This indicates the termination of the instruction.
getch():-This means get character. When in this program 'Hello world' is printed on the screen it will vanish immediately. So to stop this instruction is used. This results the program to halt and wait until a character or any key is pressed to end execution.
-------------------------------------------------------------------------------------
Now i think u have understood what a c program is to some extent from the above program.
To compile the program press ALT+f9.This will show the errors if any. If any errors are shown then check and correct the errors. Then press CTRL+f9 to run the program.
---------------------------------------------------------------------
Now we will do the further program which still harder than the previous one.
I will explain the newer instructions in the program.
************************************************************************
#include"stdio.h"
#include"conio.h"
void main()
{
int x;
clrscr();
x=10;
printf("%d",x);
getch();
}
O/p=10
************************************************************************
One term ‘clrscr();’ is used in this program. It is used to clear the contents of the previous program on the user screen. It ends with a semicolon.
int:-This stands for integer.
Float:-this means also integers but having decimal point.
This means we are declaring a variable named x having type integer.
this means we are allotting or booking a space for an integer in the computer memory and giving it name x so that we can access that integer stored in the memory named x.
x=10; :-This means we are storing the value 10 in the memory location named x.
%d :- this indicates that the output to be printed is of type integer.
%f : - This indicates that the output is of type float.i.e having decimal point.
There is one more term i.e
Char:- It is used to allocate space for character.
%c :- it indicates that output is of type character.
Memory allocations & example:-
Int:-2 bytes e.g- 40, 111
Float: - 2 bytes e.g- 4.4, 100.55
Char: - 1 byte e.g- a to z
Int, float, char are called the data types.
For character the ASCII values can be used.
ASCII means American standard code for information interchange.
The ASCII values
A to Z= 56 to 82
A to z=97 to 123
i.e if u declare character assign it a value and then print its value by taking its data type int the it will print its ASCII value.
#include”stdio.h”
#include”conio.h”
void main()
{
char x;
x=A;
printf(“%c”,x);
printf(“%d”,x);
getch();
}
O/P=A56
***********************************************************************
Here A is the output of the first printf & 56 is the output of the second printf.
In float the number without decimal point is given with decimal point.
e.g- 40 is given as 40.00
Now we will see how to accept data from user and work on it.
We use the same operators which we use in our normal mathematical operations to do calculations on numbers.
From now onwards I will not write the #include”stdio.h” & #include“conio.h” int the program. It should be assumed and written in the program. Other header files except this header files will only be included.
void main()
{
int x,y,z;
clrscr();
printf(“Enter the first number”);
scanf(“%d\n”,&x);
printf(“Enter the second number\n”);
printf(“\n”);
scanf(“%d”,&y);
z=x+y;
printf(“\n%d”,z);
getch();
}
O/P:- Enter the first number 45
Enter the second number
50
95
************************************************************************
In this program first 3 variables are declared. First number is stored in x, second in y and the addition of x & y is stored in z.
scanf : -This is used to accept input from user. The data types are given in the double quotation and the ampersand sign is used.
See here we have used ‘\n’. This means the control will go to the next line after ‘\n’.
First we have used it after %d. that means the control will go to the next line after accepting the number.
Then we have given it in printf which means it will go to the next line where it is printed.
Then it is used before %d it means that it will go to the next line before printing the output.
Like + operator the operators like -,*,/,% can also be used.
This program can be done in still simpler way.
printf(“Enter the numbers”);
scanf(“%d%d”,&x,&y);
and everything as before.
O/P= Enter the numbers 45 55
100
Like ‘\n’ which is used to go to the next line ‘\t’ is also used which means tab space. It gives one tab space in the program where it is printed or used.
‘%c’ is the data type of characters.
Similarly one more data type is used i.e %s. It is used to accept group of characters. For that the concept of array is used which will be given later.

Monday, December 8, 2008

Csubodh

I'm an IT engineering student. Here i have some easy points on c language & some part on data structure using C.
---------------------------------------------------------------------
All things in this are based on windows platform.
To perform this program u have to install turbo c/c++.
Then in bin folder double-click on tc.
click on file and click new.
Then start typing the program.
Note that the instructions should be in either upper or lower case.
So first let me give u a simple program & then explain the terms.
************************************************************************
#include"stdio.h"
#include"conio.h"
void main()
{
printf("Hello world");
getch();
}
O/P=Hello world
************************************************************************
include:-This means including the file from the include folder which contains the information of the words in angular bracket. in any case this means the same.
#:-This is to differentiate the include files.
" ":-This is the way in which the include files are represented. This can also be represented as < >.
"" searches the header file everywhere on the
.h:-Extension of the header file.
stdio:-This means standard input & output.
conio:-This means console input output.
void:-This means there is no return type for main. Now it will be better to assume that this is a must component. The meaning of this will be understood on way.
main:-This is the main part which is compulsory in all the programmes.
{}-The program is enclosed in the curly brackets. These are necessary.
printf:-This is the output instruction.
(""):-This is are the must after the instruction to differentiate the output from other instruction.
;:-This indicates the termination of the instruction.
getch():-This means get character. When in this program 'Hello world' is printed on the screen it will vanish immediately. So to stop this instruction is used. This results the program to halt and wait until a character or any key is pressed to end execution.
-------------------------------------------------------------------------------------
Now i think u have understood what a c program is to some extent from the above program.
To compile the program press ALT+f9.This will show the errors if any. If any errors are shown then check and correct the errors. Then press CTRL+f9 to run the program.
---------------------------------------------------------------------
Now we will do the further program which still harder than the previous one.
I will explain the newer instructions in the program.
************************************************************************
#include"stdio.h"
#include"conio.h"
void main()
{
int x;
clrscr();
x=10;
printf("%d",x);
getch();
}
O/p=10
************************************************************************
One term ‘clrscr();’ is used in this program. It is used to clear the contents of the previous program on the user screen. It ends with a semicolon.
int:-This stands for integer.
Float:-this means also integers but having decimal point.
This means we are declaring a variable named x having type integer.
this means we are allotting or booking a space for an integer in the computer memory and giving it name x so that we can access that integer stored in the memory named x.
x=10; :-This means we are storing the value 10 in the memory location named x.
%d :- this indicates that the output to be printed is of type integer.
%f : - This indicates that the output is of type float.i.e having decimal point.
There is one more term i.e
Char:- It is used to allocate space for character.
%c :- it indicates that output is of type character.
Memory allocations & example:-
Int:-2 bytes e.g- 40, 111
Float: - 2 bytes e.g- 4.4, 100.55
Char: - 1 byte e.g- a to z
Int, float, char are called the data types.
For character the ASCII values can be used.
ASCII means American standard code for information interchange.
The ASCII values
A to Z= 56 to 82
A to z=97 to 123
i.e if u declare character assign it a value and then print its value by taking its data type int the it will print its ASCII value.
#include”stdio.h”
#include”conio.h”
void main()
{
char x;
x=A;
printf(“%c”,x);
printf(“%d”,x);
getch();
}
O/P=A56
***********************************************************************
Here A is the output of the first printf & 56 is the output of the second printf.
In float the number without decimal point is given with decimal point.
e.g- 40 is given as 40.00
Now we will see how to accept data from user and work on it.
We use the same operators which we use in our normal mathematical operations to do calculations on numbers.
From now onwards I will not write the #include”stdio.h” & #include“conio.h” int the program. It should be assumed and written in the program. Other header files except this header files will only be included.
void main()
{
int x,y,z;
clrscr();
printf(“Enter the first number”);
scanf(“%d\n”,&x);
printf(“Enter the second number\n”);
printf(“\n”);
scanf(“%d”,&y);
z=x+y;
printf(“\n%d”,z);
getch();
}
O/P:- Enter the first number 45
Enter the second number
50
95

Sunday, January 27, 2008

Hi,
I'm an IT engineering student. Here i have some easy points on c language & some part on data structure using C.
-------------------------------------------------------------------------------------
C language:-
This is based on windows platform.
To perform this pragram u have to install turbo c/c++.
Then in bin folder doubleclick on tc.
click on file and click new.
Then start typing the program.
Note that the instructions should be in either upper or lower case.
So first let me give u a simple program & then explamn the terms.
*************************************************************************************
#include
#include
void main()
{
printf("Hello world");
getch();
}

*************************************************************************************
include:-This means including the file from the include folder which contains the information of thf words in angular bracket.in any case this means the same.
#:-This is to differentiate the include files.
<>:-this is the way in which the include files are represented.
.h:-Extension of the header file.
stdio:-This means standard input & output.
conio:-This means common input output.
void:-This means there is no return type for main. Now it will be better to assume that this is a must component.the meaning of this will be understood onway.
main:-This is the main part which is compulsory in all the programmes.
{}:-The program is enclosed in the curly brackets.These are necessary.
printf:-This is the output instruction.
(""):-This is are the must after the instruction to differentiate the output from other instruction.
;:-This indicates the termination of the instruction.
getch():-This means get character.When in this program 'Hello world' is printed on the screen it will vanish immediately.So to stop this this instruction is used. This results the program to halt and wait until a character or any key is pressed to end execution.
-------------------------------------------------------------------------------------
Now u have understood what a c program is to some extent from the above program.
To compile the program press ALT+f9.This will show the errors if any.If any errors are shown then check and correct the errors.Then press CTRL+f9 to run the program.
-------------------------------------------------------------------------------------
Now we will do the further program which still harder than the previous one.
I will explain the newer instructions in the program.
*************************************************************************************
#include
#include
void main()
{
int x;
clrscr();
x=10;
printf("%d",x);
getch();
}
*************************************************************************************
int:-This stands for integer.
float:-this means also integers but having decimal point.
This means we are declaring a variable named x having type integer.
this means we are alloting or booking a space for an integer in the computer memory and giving it name x so that we can access that integer stored in the momory named x.
x=10;:-This means we are storing the value 10 in the memory location named x.

Watch tv!