Interval
Adapted by Neilor Tonin, URI Brazil | Timelimit: 1
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 Sample | Output Sample |
25.01 | Intervalo (25,50] |
25.00 | Intervalo [0,25] |
100.00 | Intervalo (75,100] |
-25.02 | Fora de intervalo |
Source Code
#include <stdio.h>
int main()
{
float s;
scanf("%f",&s);
if(s>=0&&s<=25.0000){printf("Intervalo [0,25]\n");}
else if (s>=25.00001&&s<=50.0000000){printf("Intervalo (25,50]\n");}
else if (s>=50.000001&&s<=75.0000000){printf("Intervalo (50,75]\n");}
else if (s>=75.000000001&&s<=100.000000000){printf("Intervalo (75,100]\n");}
else{
printf("Fora de intervalo\n");
}
return 0;
}
- How to Use URI Online Judge to Improve Your Coding Skills and Boost Your Career
- BEST FREE GIFT CARD GENERATOR in 2022
- উইন্ডোজ 11 এসে গেল, নজরকাড়া লুক, তাক লাগানো ফিচার্স!
- URI 2694 Solved by C programming
- URI Online Solve | 1957 Converting to Hexadecimal- Solution
- Android custom toolbar Android Studio | Android Tutorial
- URI Online Judge | 1040 Solution | Average 3
- URI Online Judge | 1038 Solution |Snack
- URI Online Judge | 1037 Solution | Interval
- URI Online Judge | 1036 Solution | Bhaskara’s Formula
- URI Online Judge Solution| 1035 Selection Test 1
- URI Online Judge Solution| 1021 Banknotes and Coins
- URI Online Judge Solution| 1020 Age in Days
- URI Online Judge Solution| 1019 Time Conversion
- URI Online Judge Solution| 1018 Banknotes