The Question is Read 10 numbers in array and print Reverse Order. To Print in Reverse Order we can run the loop from highest point with decrements But thee we Reverse the Array. Lets begun.
Codes Goes Here
 ```1 2 3 4 5 6``` `7` `8` `9` `10` `11` `12` `13` `14` `15` `16` `17` `18` `19` `20` `21` ```#include #include main() {``` ` int a,i,n,tmp;` ` printf("How many Values you want to insert in the array\?");` ` scanf("%d",&n);` ` printf("Enter the values in the array");` ` for(i=0;i

for(i=0;i<n/2;i++)
Here this Loop Swap the values. So we need to run the program for just half time of total values in Array. If the loops runs for n times it will swap values back. As we define n as int. so n/2 will always be int. If you need more explanation don't forget to ask through comment.
The function that we used in previous article is of no use as we can write those piece of words in the main functions insist of calling the other function. those functions always perform the same task. It will be very useful if we can provide some more instruction to them and the work accordingly.f t

Here is the general format of the function that can get value and perform the task.
return_type function name(dataype argument1, datatype argument2)
{
local veriable deceleration
statememts;
return;
}

It will be clear if showing some example insist of formate so here goes a sample example. we will describe it later.

```#include<stdio.h>
```
`int add(int, int, int);`
`int main()`
`{`
`int a,b,c,sum;`
`printf("Enter the three numbers:- ");`
`scanf("%d %d %d",&a, &b, &c);`
`sum = add(a,b,c);`
`printf("Finally the sum is %d",sum);`
`return 0;`
`}`
`int add(int x, int y, int z)`
`{`
`int ans=x+y+z;`
`return(ans);`
`}`
Here goes Output
`Enter the the three numbers:- 1 2 3`
`Finally the sum is 6`

Now We will define the program.
Int add(int, int, int)
As mentioned earlier we should Declare that the function add will be used in the program. we should define the data type it can receive.
Then add(a,b,c) Here the variables a b and c are passed to the functions add and a,b and c are actual arguments.
Then int add(int x, int y, int z) Here the variables value passed are stored in x,y and z. and are known as formal arguments.
return(ans); will return the value to the the function it was called.
sum will now get the value and finally printed out.

After calling a function the calling function wait till the function run out of statements to be excited. If you need any help on programs or any confusion please let us know form the comment box below.
A function in C is a block of statements that perform task of some kind. Every c program have collections of functions. You can use a function to perform certain task that are usually need to be done so that for every time you need to preform that task you don't need to rewrite the code insist call the function to do that task. Its something like hiring  some person to do some special task for you.
Here goes a example program:

```#include<stdio.h>
```
`void text();/* we need to declare that we are using this function in program */`
`int main()`
`{`
`text()/* calling function text */`
`printf("The message peinted above is from function test.");`
`return 0;`
`}`
`void text`
`{`
`printf("How is your day\?\n");`
`}`

Output:
```How is your day?
The message peinted above is from function test.
```

In this program above we define two functions main() and text()
we use the function test in three location. The first is to inform the program that we are using text function. Its like informing to friends before visiting them.
Second time inside the main function to call the function from main function. so now the programs go the the function text and perform the task and come back and continue.
At last we create a function. that's all.

A function can be called any numbers of time as needed. we can create any numbers of functions as needed. we can call any function(except main) from from any function. But another function cannot defined inside another function.
Basically there are two types of functions:
Library Functions: pritnf() scanf() etc and
User defined functions text() message()
A functions can be named any but should no be the keyword.
Loops will help you to do some tasks that need to be do a statement repeating until the time you set or till some conditions.
There are three method in c for where you control loop in c.
Loops are the most for C programming Be prepared for all loops. and work hard on it.

#### The while loop

The while loop repeats a statement until the test at the top proves false. the while has the form:
while (expression)
{
Statements;
}
For example
int x=3;
while (x>0)
{
printf("x=%d\n",x);
x--;
}
output:
x=3
x=2
x=1

Because the while loop can accept expressions, not conditions.

#### The do while loop

This is vary similar to the while loop excepted that the test occurs at the end of the loop body. This guarantees that the loop is executed at leas once before continuing. Such a step is frequently used where data is to be read. the rest then verifies the data, and loops back to read again if it was unaccepted The do while loop has the form:
do
{
statement;
}
while(expression);
example
int x=3;
do
{
printf("x=%d\n",x--);
}
while(x>0);
output
x=3
x=2
x=1

#### The for loop

The for loop works where the number of iteration of the loop is known before the loop variable is entered. The head of loop consists of three parts separated by semicolons.
• The  first is rune before the loop is entered. This is usually the initialization of the loop variable.
• The second is a test, the loop is excited when this returns false.
• The third is a statement to be run every time the loop body is complicated.This is usually an increment for the loop counter.
The C for statement has the following form:
for(expression1; expression2; expression3)
{
statement;
}
expressioninitialises; expressionit the terminate test; expressionis the modifier;
Simple example:
int x;
main()
{
for(x=3;x>0;x--)
{
printf("x=%d\n",x);
}
Output:
x=3
x=2
x=1

in c programming we need to control some decisions as if this comes true the program should do this else the program should do this. Today we will learn about all these.

#### If Statement

if statement is used when we want some part of program should be operated only if some conditinn is true. General form of if statement is if (Condition)
Do this;

`if (a==b)`
`printf("a and b are equal");`

In above program a and b are equal is displayed only when a are equal to b.

#### If else statement

if(a==b)
printf("a and b are equal");
else
printf("a and b are not equal");

#### If else if statement

if(a>80)
printf("Distionction");
else if (a>60 && a<80)
printf("First division");
else if(a<60 && a>40);
printf("Passed");
else
printf("Failed");

#### Nested if else

if()
{
if()
do this
else
do this
}
else if ()
{
if()
{
if()
do this
else
do this
}
else
do this
}
else
do this

The above is simple structure.

Next we will go to loop control structure do comment if you need help in some programs in your Lab assignment questions or class questions.
Here is a simple program of c. Try not to learn what is that just understand and looks how program goes on. For learning go through program and come back to understand. as your mind will make some ideas from first view.

`1. /* Simple Basic Program */`
`2. #include<stdio.h>`
`3. #include<conio.h>`
`4. main()`
`5. {`
`6. printf("Hello Sansar!");`
`7. getch();`
`8. }`

The first line is a comment you can write whatever you want inside /* and */ it wont affect in program.
The Second 2 lines are header files they call library functions to work in the program. stdio.h is For Standard Input/Output library. You must have that header to use printf() function.
conio.h is called to use getch() function in program.
Line no 4 define main function. The function main will be called first when program starts. all the commands on main function are covered inside { and } braces.
line no 6 printf("Hello Sansar!"); will print in the screen. printf is a library function to print out. every statement on c program should ends with ;.
getch() function hold the screen till some character are inserted from keyboard. however modern compiler did not need this while programming.

How a program should be written?

• Program should be in same order that programmer want it to be executed.
• tabs and spaces can be added as needed for better looks and easy for debugging.
• Remember all statements are in small case letter. C is case sensitive.
• C is called free-form language. as there is no any rule for position where statement should be written.
• Every C statement must end with ;. ; is a terminator for all statement.

This is basic of all so next we will go to if else else if condition. Comment if need any helps out there.
In Programming in C we Will study:

#### Introduction:

History of computing and computes, programming, block diagram of computer, generation of computers, types of computers, software, Programming languages, Traditional and structural programming concepts.

#### Files and file Handaling

All mentioned are the Syllabus of C programming. Pokhara University.