First Encounter with ACM — This Is the World of Programs

Words: 104

The most classic example

0<a<100

has to be written as

0<a&&a<100

This is exactly what calls for a shift in thinking and discipline in usage

Every place has its rules

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include<stdio.h>
int main()
{
    int n;
    while(scanf("%d",&n)!=EOF)
    {
    if(n<=100&&n>=0)
        {
        if(n<60)
        printf("E\n");
        if(n>=60&&n<70)
        printf("D\n");
        if(n>=70&&n<80)
        printf("C\n");
        if(n>=80&&n<90)
        printf("B\n");
        if(n>=90&&n<=100)
        printf("A\n");
        }
    else
        {
        printf("Score is error!\n");
        }

    }
    return 0;
}

Speaking of which, looking at problems like this now… they actually set this one? -.-

This post is licensed under CC BY-NC-SA 4.0. If it helped, or if you have anything to say, the comment box below is open.
Page views —
Unique visitors —

Loading...