#include<stdio.h>
void read(int a[50],int n);
void display(int a[50],int n);
void delete_last(int a[50],int n);
int main()
{
int n,a[50],element,sum_array;
printf("Enter the size of the array\n");
scanf("%d",&n);
printf("Enter the array elements \n");
read(a,n);
printf("The array elements are\n");
display(a,n);
delete_last(a,n);
}
void read(int a[50],int n)
{
int i;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
}
void display(int a[50],int n)
{
int i;
for(i=0;i<n;i++)
{
printf("%d\t",a[i]);
}
}
void delete_last(int a[50],int n)
{
int i;
n=n-1;
printf("\nafter deleting last element, the array is\n");
for(i=0;i<n;i++)
{
printf("%d\t",a[i]);
}
}
Output:
Comments
Post a Comment