Answers for "print an array in reverse order"

3

how to print array backwards

var array = ['a','b','c','d','e','f','g']
var j = array.length 

for(var i = 0; i < array.length ; i++){
    console.log(array[j])
    j=j-1 }

    /*

var j holds value of the array's number of values so every time in the loop it decrements by 1 making the 
function print a backwars array



    */
Posted by: Guest on June-05-2020
0

print array in reverse order

#include <stdio.h>

int main() {
   int array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
   int loop;

   for(loop = 9; loop >= 0; loop--)
      printf("%d ", array[loop]);
      
   return 0;
}
Posted by: Guest on September-14-2021

Code answers related to "print an array in reverse order"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language