My issue
hello everyone !
I was solving a question of array ,I am new to code and and seen that in many contest the question related to array has been asked so can you guys help me solving this question in this question I am getting extra yes instead of no and at the end of the problem also I am getting one yes, thankyou for your supports.
My code
#include <iostream>
using namespace std;
void slope()
{
int n;
cin>>n;
int a[n];
for(int i = 0; i <n;i++)
{
cin >> a[i];
}
for(int i = 1; i < n ;i++)
{
if(a[i] < a[i - 1])
{
cout<<"NO"<<endl;
}
}
cout<<"yes "<<endl;
}
int main() {
// your code goes here
int t;
cin>>t;
while(t > 0)
{
slope();
t--;
}
return 0;
}
Learning course: Arrays using C++
Problem Link: CodeChef: Practical coding for everyone