1. Write a program to read n number in an array and display it in reverse order.
- #include<stdio.h>
- void main()
- {
- int n;
- int arr[100]; //can be stored upto 100 numbers
- printf("Please input the number of elements to store in the array : ");
- scanf("%d", &n);
- printf("Please input %d numbers : ", n);
- for(int i=0; i<n; i++){
- scanf("%d", &arr[i]);
- }
- printf("Reverse the numbers are : ");
- for(int i=n-1; i>=0; --i){ //--i or i-- both are okay
- printf("%5d", arr[i]);
- }
- }
একটি মন্তব্য পোস্ট করুন