C++ program to show the working of pointer

// pointer in c++
#include<iostream.h>
#include<conio.h>
void main()
{
int a,*p1;
clrscr();
p1=&a;
cout<<"\nThe address of a:"<<p1;
p1+=2;
cout<<"\nThe address of a after increment: "<<p1;
getch();
}

Output

Demonstration of pointers in c++.
C++ pointer demonstration

C program to find the median of n numbers

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a[10],i,n;
float m;
printf("Enter the size of the array: ");
scanf("%d",&n);
printf("Enter the elements:\n");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
if(n%2==0)
{
m=(a[n-1/2]+(a[n/2]))/2;
}
else
{
m=a[n/2];
}
printf("\nMedian is %f",m);
getch();
}

Output

median of n numbers c program
Median of n numbers