HOME

Sunday, May 3, 2015

C PROGRAM TO DELETE NUMBER FROM IT LOCATION IN ARRAY

#include<stdio.h>
#include<conio.h>
void main()
{
 int a[]={1,2,4,5,6,74,32};
 int position,i;
 printf("the number are:\n");
 for(i=0;i<7;i++)
 {
     printf("%d\t",a[i]);
 }
 printf("\nenter the position to delete\n");
 scanf("%d",&position);
 for(i=position;i<=7;i++)
 {
     a[i-1]=a[i];
 }
 printf("\nthe data after deletion is:\n");
 for(i=0;i<6;i++)
 {
     printf("%d\t",a[i]);
 }
}

No comments:

Post a Comment