‘C’ program to accept an array of n float values and display them in the reverse order.
C File =>
/* Write a ‘C’ program to accept an array of n float values and display them in the reverse order. */
#include<stdio.h>
int main()
{
int n,i;
float arr[30];
printf("\n How many elements? ");
scanf("%d",&n);
// Accepting input
for(i=0;i<n;i++)
{
printf("\n Enter element%d : ",i+1);
scanf("%f",&arr[i]);
}
printf("\n Array elements in Reverse order : \n");
for(i=n-1;i>=0;i--)
printf("%.2f\t",arr[i]);
return 0;
}
Comments
Post a Comment
Please do not enter any spam link in message.