write a program to display the array elements in reverse
order in c language
Answer Posted / prajot chougale
#include<stdio.h>
main()
{
int n, c, d, a[100], b[100];
printf("Enter the number of elements in array\n");
scanf("%d",&n);
printf("Enter the array elements\n");
for ( c = 0 ; c < n ; c++ )
scanf("%d",&a[c]);
for ( c = n - 1, d = 0 ; c >= 0 ; c--, d++ )
b[d] = a[c];
for ( c = 0 ; c < n ; c++ )
a[c] = b[c];
printf("Reverse array is\n");
for( c = 0 ; c < n ; c++ )
printf("%d\n", a[c]);
return 0;
}
Is This Answer Correct ? | 5 Yes | 4 No |
Post New Answer View All Answers
How many levels deep can include files be nested?
What is action and transformation in spark?
Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix
How reliable are floating-point comparisons?
int i=10; printf("%d %d %d", i, i=20, i);
What are the types of assignment statements?
How can you tell whether two strings are the same?
Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon
Why c is called object oriented language?
How is a null pointer different from a dangling pointer?
What is the difference between a string and an array?
How does sizeof know array size?
write a program to concatenation the string using switch case?
When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.
how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.