Welcome

>>>Welcome to my "CODE BAZAR"
Code marshal
URI online judge
Others
Code marshal
URI online judge
Others
Code marshal
URI online judge
Others

Update ✔✔✔ Upcoming programming book (.pdf) "Programming Contest (data structures and algorithms) by Md. Mahbub Hasan & "Graph Algorithms" by Safayat Asraf "****** Date: 20 March, 2019****Hazrat Ali****

Sunday, 13 November 2016

URI-1035

URI Online Judge | 1035

Selection Test 1

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
Problem link Click here
Read 4 integer values A, B, C and D. Then if B is greater than C and D is greater than A and if the sum of C and D is greater than the sum of A and B and if C and D were positives values and if A is even, write the message “Valores aceitos” (Accepted values). Otherwise, write the message “Valores nao aceitos” (Values not accepted).

Input

Four integer numbers A, B, C and D.

Output

Show the corresponding message after the validation of the values​​.
Input SampleOutput Sample
5 6 7 8Valores nao aceitos
2 3 2 6Valores aceitos



Solution....

#include<stdio.h>
int main()
{
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    if(b>c && d>a && (c+d)>(a+b) && c>0 && d>0 && a%2==0){
        printf("Valores aceitos\n");
    }
    else
    {
        printf("Valores nao aceitos\n");
    }
    return 0;
}



URI-1037

URI Online Judge | 1037

Interval

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
Problem link Click here
You must make a program that read a float-point number and print a message saying in which of following intervals the number belongs: [0,25] (25,50], (50,75], (75,100]. If the read number is less than zero or greather than 100, the program must print the message “Fora de intervalo” that means "Out of Interval".
The symbol '(' represents greather than. For example:
[0,25] indicates numbers between 0 and 25.0000, including both.
(25,50] indicates numbers greather than 25 (25.00001) up to 50.0000000.

Input

The input file contains a floating-point number.

Output

The output must be a message like following example.
Input SampleOutput Sample
25.01Intervalo (25,50]
25.00Intervalo [0,25]
100.00Intervalo (75,100]
-25.02Fora de intervalo

Solutin......

#include<stdio.h>

int main()
{
    double n;
    scanf("%lf",&n);
    if(n<0 || n>100){
        printf("Fora de intervalo\n");
    }
    else if(n<=25.00){
        printf("Intervalo [0,25]\n");
    }
    else if(n<=50.0){
        printf("Intervalo (25,50]\n");
    }
    else if(n<=75.0){
        printf("Intervalo (50,75]\n");
    }
    else if(n<=100.0){
        printf("Intervalo (75,100]\n");
    }
    return 0;
}