Uri 1113 solution || Beecrowd1113 Ascending and Descending Solution

Ascending and Descending

Introduction

URI Online Judge is a popular platform among developers for practicing coding skills. One of the problems on the platform is “Bee Crowd – 1113 Ascending and Descending,” and in this article, we will provide a comprehensive solution to the problem in C++, C, and Python.

Understanding the Problem

The “Bee Crowd – 1113 Ascending and Descending” problem requires us to sort an array of integers in ascending and descending orders. We need to implement two separate sorting algorithms for both ascending and descending orders.

Solution in C

#include<stdio.h>
int main()
{
    int x, y;
    while(1)
    {
        scanf("%d%d", &x, &y);
        if(x==y)
        {
            break;
        }
        else if(x>y)
        {
            printf("Decrescente\n");//uri 1113 solution
        }
        else
        {
            printf("Crescente\n");
        }
    }
    return 0;
}

Solution in C++

#include<iostream>
using namespace std;
int main()
{
    int x,y;
    while(1)
    {
        cin>>x>>y;
        if(x==y)
        {
            break;
        }

     else if(x>y)
    {
        cout<<"Decrescente"<<endl;//Uri 1113 solution
    }
    else
    {
        cout<<"Crescente"<<endl;
    }
    }
    return 0;
}

Previous problem: Beecrowd 1161 Factorial Sum Solution

Leave a Comment