Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

Comment



Iterative statement



" ; " after loop



Test expression



Working with switch case




Array_deletion




// AHF C PROGRAM SOLVING

//solving here 2_D   ARRAY 	programming problem

#include<stdio.h> #include<math.h> #define pf printf int main() { int i,n,pos,arr[100],temp; pf("Enter the number of element in the array: "); scanf("%d",&n); //taking array element pf("\nEnter the array element: "); for(i=0;i < n;i++) scanf("%d",&arr[i]); //taking deleted position pf("\nEnter the deleted position: "); scanf("%d",&pos); //containing deleted number temp=arr[pos]; //position is deleted for(i=pos;i < n;i++) arr[i]=arr[i+1]; //printing output, deleting given position number pf("\nThe array after deletion: "); for(i=0;i < n-1;i++) pf("\t%d",arr[i]); //showing the deleted number pf("\nThe deleted number is: %d",temp); return 0; }
OUTPUT:


© 2018 - All rights reserved