#include <stdio.h>

typedef struct point{
    int xpos;
    int ypos;
}Point;

typedef struct Rectangle{
    Point upleft;
    Point lowright;
}Rectangle;

int recArea(Rectangle a){
    int width = a.lowright.xpos - a.upleft.xpos;
    int heigh = a.lowright.ypos - a.upleft.ypos;
    int area = width*heigh;
    return area;
}

void showPoint(Rectangle a){
    printf("[%d, %d]\n", a.upleft.xpos, a.upleft.ypos);
    printf("[%d, %d]\n", a.upleft.xpos,a.lowright.ypos);
    printf("[%d, %d]\n", a.lowright.xpos, a.lowright.ypos);
    printf("[%d, %d]\n", a.lowright.xpos, a.upleft.ypos);
}

int main(void){
    Rectangle R= {{0, 0}, {100, 100}};
    
    printf("%d\n", recArea(R));
    showPoint(R);
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: