C Program - Reverse of int array of random numbers



#include<stdio.h>
#include<stdlib.h>
#include<time.h>

void main()
{
//Array named arr with 10 elements
int arr[10] = { 0 };
srand(time(NULL));
printf("The 10 random numbers are = \n");
//For loop to enter 10 random numbers as array elements.
for (int counter = 0; counter < 10; counter++)
{
//inserting random numbers as array elements
arr[counter] = (rand() % 100) + 1;
printf("%d\n", arr[counter]);
}
//Printing the reverse order of numbers.
printf("\nThe reverse order of numbers is = \n");
for (int counter = 9; counter >= 0; counter--)
{
printf("%d\n", arr[counter]);
}
getch();
}

Comments

Popular posts from this blog

How to Block Websites without using any Software.

C Program - Greater, less and Equal

C Program - Even Odd