Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const int SIZE=50;
- void main()
- {
- int arr[SIZE],i,j,input,counter2=0,index,temp_counter,temp_index;
- cout<<"please enter natural numbers";
- i=0;
- do
- {
- cin>>input;
- }
- while (input != -1)
- {
- arr[i]=input;
- i++;
- }
- for (j=0; j<i; j++)
- {
- if (arr[j]>=arr[j+1])
- {
- counter2++;
- index=j;
- }
- temp_counter=counter2;
- temp_index=index;
- }
- cout<<"the index is" << temp_index<< endl;
- }
Add Comment
Please, Sign In to add comment