Assignment number 3 Q1 program to delete the largest number from the array by passing it to function and function should not retun . #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; ...
Posts
Showing posts from December, 2021
- Get link
- X
- Other Apps
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++ ) ...