C++ program that inputs five floating-point values in an array and displays the values in reverse order. Program: #include<iostream> using namespace std; int main() { float arr[5]; int i, num; cout<<" How many numbers do you want to Enter: "; cin>>num; cout<<" Enter "<<num<<" numbers: "; for(i=0; i<5; i++) cin>>arr[i]; cout<<"\nThe Original Array is:\n"; for(i=0; i<5; i++) cout<<arr[i]<<" "; cout<<"\n\nThe Reverse of Given Array is:\n"; for(i=(5-1); i>=0; i--) cout<<arr[i]<<" "; cout<<endl; return 0; } Output: ...
C++ program that inputs five floating-point values in an array and displays the values in reverse order.
Program:
#include<iostream>
using namespace std;
int main()
{
float arr[5];
int i, num;
cout<<" How many numbers do you
want to Enter: ";
cin>>num;
cout<<" Enter
"<<num<<" numbers: ";
for(i=0; i<5; i++)
cin>>arr[i];
cout<<"\nThe Original Array
is:\n";
for(i=0; i<5; i++)
cout<<arr[i]<<"
";
cout<<"\n\nThe Reverse of Given
Array is:\n";
for(i=(5-1); i>=0; i--)
cout<<arr[i]<<"
";
cout<<endl;
return 0;
}
Output:
Comments
Post a Comment