reverse array in c
// arr is the array
// a is length of array
int j = a-1;
for(int i = 0; i<j; i++){
arr[i]^=arr[j];
arr[j]^=arr[i];
arr[i]^=arr[j];
j--;
}
reverse array in c
// arr is the array
// a is length of array
int j = a-1;
for(int i = 0; i<j; i++){
arr[i]^=arr[j];
arr[j]^=arr[i];
arr[i]^=arr[j];
j--;
}
c program to reverse a number
#include <stdio.h>
int main() {
int n, rev = 0, remainder;
printf("Enter an integer: ");
scanf("%d", &n);
while (n != 0) {
remainder = n % 10;
rev = rev * 10 + remainder;
n /= 10;
}
printf("Reversed number = %d", rev);
return 0;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us