🔒 Closed Pa check po Ng sagut ko

Status
Not open for further replies.

If Else

Established
create and array size with size of 5 and insert any number item into endex 4
main() {
Int LA[]=1,2,3,4,5
int item=5 k=2 n=5
Int i= 0,j=k


printf("The original array elements are :\);
for(i = 0; i<n; i++) {
printf("Array[%d] = %d \, i, Array); }
n = n + 1;
while( j >= k) {
Array[j+1] = Array[j];
j = j - 1; }
Array[k] = item;
printf("The array elements after insertion :\);
for(i = 0; i<n; i++) {
printf("Array[%d] = %d \, i, Array);

}}
 
palagay po sa code container/block ts para madaling mabasa.
Screenshot_20221017-203804.webp
Screenshot_20221017-203814.webp

Pa help nlng po sir bakit tatlo lng Ang lumabas pag execute ko.
 
C:
#include <stdio.h>

int main()
{
    int array[] = {5, 10, 15, 20, 25};
   
    printf("Original Array\n");
   
    for(int i = 0; i < 5; i++)
        printf("%d, ", array[i]);
       
      printf("\n");

    //insert any number to index index 4
    array[4] = 100;
   
    printf("New Array\n");
   
    for(int i = 0; i < 5; i++)
        printf("%d, ", array[i]);

    return 0;
}
 
Status
Not open for further replies.

Similar threads

About this Thread

  • 3
    Replies
  • 442
    Views
  • 2
    Participants
Last reply from:
Arcturus

Trending Topics

Online now

Members online
1,205
Guests online
1,125
Total visitors
2,330

Forum statistics

Threads
2,278,081
Posts
28,980,731
Members
1,228,220
Latest member
lukas1803
Back
Top