URI Problem 1961 (Jumping Frog) solution( Bangla ) | C language

**Before watching this make sure that you’ve tried enough**

#include<stdio.h>

int  main()
{
    int p,n,a,checker,i;

    while(scanf("%d %d",&p,&n)!=EOF)//first line of input
    {
        int ar[n];
        checker = 0;
        for(i = 0;i < n;i++)
            scanf("%d",&ar[i]);//second line of input
        for(i = 0;i < n-1;i++){
            a = ar[i+1]-ar[i];
            if(a<0)a *= -1;//if the difference is negative
            if(a>p){
                checker = 5;
                break;
            }
        }
        if(checker==5)printf("GAME OVER\n");
        else printf("YOU WIN\n");
    }

    return 0;
}

 

If this solution helped you, please share this with your friends.
And if you have anything to say, let me know in the comment section.

More solutions are coming so Like our Facebook page and Subscribe to our YouTube channel to stay connected.

Leave a Comment