Help me in solving RATINGINPRAC problem

My issue

code and structure

My code

#include <stdio.h>

int main(void) {
	int T;
	scanf("%d",&T);
	for(int i=0;i<T;i++)
	{
	    int d1,d2;
	    if(d1>=d2)
	    printf("yes\n");
	    else
	    printf("no\n");
	}
	return 0;
}


Learning course: Arrays using C
Problem Link: CodeChef: Practical coding for everyone

@veeraprasad
plzz refer the following C code for better understanding of the logic and implementation.

#include <stdio.h>
#include <string.h>

int main() {
    int t;
    scanf("%d",&t);
    for(int i=0;i<t;i++){
        int n;
        scanf("%d",&n);
        int a[n];
        for(int j=0;j<n;j++){
            scanf("%d ",&a[j]);
        }
        int ch=0;
        for(int j=1;j<n;j++){
            if(a[j]<a[j-1]){
                ch=1;
            }
        }
        if(ch)
        printf("no\n");
        else
        printf("yes\n");
    }


    return 0;
}

You should take input properly. Take the array and iterate over it to see if it’s acsending or not.

Corrected Code:

#include <stdio.h>

int main() {
    int t;
    scanf("%d", &t);
    while (t--) {
        int n, flag = 1;
        scanf("%d", &n);
        int a[n];
        for (int i = 0; i < n; i++) {
            scanf("%d", &a[i]);
        }
        for (int i = 0; i < n - 1; i++) {
            if (a[i] > a[i + 1]) {
                printf("No\n");
                flag = 0;
                break;
            }
        }
        if (flag) {
            printf("Yes\n");
        }
    }
    return 0;
}