S. Interval – Codeforces Problem Solution in C

Disclaimer: Make sure you tried enough before checking the solution

Problem: https://codeforces.com/group/MWSDmqGsZm/contest/219158/problem/S

//https://codeforces.com/group/MWSDmqGsZm/contest/219158/problem/S
//Checking intervals
#include<stdio.h>
int main() {
    double x;
    scanf("%lf",&x);
    if(x>=0 && x<=25){
        printf("Interval [0,25]");
    }
    else if(x<=50 && x>25){
        printf("Interval (25,50]");
    }
    else if(x>50 && x<=75){
        printf("Interval (50,75]");
    }
    else if(x>=75 && x<=100){
        printf("Interval (75,100]");
    }
    else{
        printf("Out of Intervals");
    }

    return 0;
}

Assiut University Training – Newcomers solution

Leave a Comment