Menu Close

Complete the error page module?…[Cprogm] FcukTheCode

Ana is involved in developing a new web browser

After many sleepless nights she finishes most of the modules of her new web browser and only server error pages notification module is left out.

She is planning to launch her browser within a weeks time. So can you help her to complete the error page module?

Functional Description:

400-BAD REQUEST

401-UNAUTHORIZED

403-FORBIDDEN

404-Not Found

500-Internal Server Error

Input:
The first line integer input contains HTTP status code.

Output:
Print the appropriate server status as output in a single line.

#include <stdio.h>
typedef enum{BADREQUEST=400,UNAUTHORIZED=401,FORBIDDEN=403,NOTFOUND=404,INTERNALSERVERERROR=500}Status;
int main()
{Status serverstatuscode;
 scanf("%u",&serverstatuscode);
 if(serverstatuscode==BADREQUEST) printf("BAD REQUEST");
 else if(serverstatuscode==UNAUTHORIZED) printf("UNAUTHORIZED");
 else if(serverstatuscode==FORBIDDEN) printf("FORBIDDEN");
 else if(serverstatuscode==NOTFOUND) printf("NOT FOUND");
 else if(serverstatuscode==INTERNALSERVERERROR) printf("INTERNAL SERVER ERROR");
return 0;
}

INPUT_1:
500

OUTPUT:
INTERNAL SERVER ERROR


INPUT_2:
403

OUTPUT:
FORBIDDEN


INPUT_3:
401

OUTPUT
UNAUTHORIZED


INPUT_4:
400

OUTPUT:
BAD REQUEST


INPUT_5:
404

OUTPUT:
NOT FOUND


ILLUSTRATION

executed using gcc