C Program to Reverse a Number

#include <stdio.h>

void taks(int arr[] ,int ); 

int main()

{int a;

printf("*****program to delete the largest number from the array*****\n\n");

printf("Enter the length of array : ");

scanf("%d",&a);

int arr[a];

for (int i=0;i<a;i++) {

    printf("enter the element number %d : ",i+1);

   scanf("%d",&arr[i]);

}

//calling the function 

taks(arr,a);

}


void taks(int arr[],int n){

    int value;

    int arnew[n];

    //save the array in new array for further use 

    for(int i=0;i<=n;i++){

        arnew[i]=arr[i];

    }

    //finding the place where larger number is 

for (int i = 0; i < n; ++i) {

    if (arr[0] < arr[i]) {

      arr[0] = arr[i];

      value=i;

    }

  }

  // deleting the larger number

for (int  c = value ; c < n - 1 ; c++ ) 

        arnew[c] = arnew[c+1];        

        

        printf("Resultant array is\n");

        //printing the new array list 

        for( int c = 0 ; c < n - 1 ; c++ )        

        printf("%d\n", arnew[c]); 

}

*****program to delete the largest number from the array*****

Enter the length of array : 5
enter the element number 1 : 7
enter the element number 2 : 2
enter the element number 3 : 36
enter the element number 4 : 1
enter the element number 5 : 5
Resultant array is
7
2
1
5

Comments