Answer to Question #220722 in C++ for Vasanth

Question #220722
Consider an array of student marks for subject Data structure of 50 students in a class. Faculty had wrongly entered marks for a student (Roll no 36). So write a module in C language to delete the student mark and update the list. Also enter a mark at last of the array.
1
Expert's answer
2021-07-27T07:44:31-0400
#include <stdio.h>
int main()
{
    int n=5;
    int arr[n], p;
    printf("Enter %d elements\n", n);


   for (int i = 0; i < n; i++)
      scanf("%d", &arr[i]);


   printf("Enter the location where you wish to delete element\n");
   scanf("%d", &p);


   if (p >= n+1)
      printf("Impossible.\n");
   else
   {
      for (int i = p - 1; i < n - 1; i++)
         arr[i] = arr[i+1];


   }
   arr[p]=46;
   return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS