en
Feedback
inactive

inactive

Closed channel
3 849
Subscribers
No data24 hours
-297 days
-12730 days
Posts Archive
6 4 2 4 4 6 2

#include<iostream> using namespace std; int main() { int n; cin >> n; char arr[n]; for ( int i = 0; i < n; i++) { cin >> arr[i]; } cout<<"Updated array: "; for (int i = n - 1; i >= 0 ; i--) { cout << arr[i] << " "; } return 0; }

10 9 8 6 7 8 3 1 2 4 8 Output 2 : Updated array: 8 4 2 1 3 8 7 6 8 9 Input 3 : 8 S T R I N G S !

int n; cin>>n; string arr[n]; for(int i=0; i>arr[i]; } cout<<"Updated array: "; for (int i = 0; i < n; i++) { int count = 0; for (int j = i -1 ;j>= 0; j--) { if (arr[i] == arr[j]) { count++; break; } } if (count == 0) { cout << arr[i] << " "; } } }

8 Grapes Grapes Grapes Grapes Banana Banana Guava Guava