Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
903 B
6
Indexable
Never
#include <stdio.h>
struct sBlock{
    int start, end;
};

int main() {
    struct sBlock block;
    block.start = -1;
    block.end = -1;
    int first = -1, second = -1, third = -1;
    while(block.start < 0 || block.start > 5){
        printf("Enter START, between 0 and 5: ");
        scanf("%d", &block.start);
        if(block.start < 0 || block.start > 5)
            printf("Invalid START, try again. \n");
    }
    while(block.end < block.start || block.end > 9){
        printf("Enter end, between %d and 9: ", block.start);
        scanf("%d", &block.end);
        if(block.end < block.start || block.end > 9)
            printf("Invalid END, try again. \n");
    }
    int size = block.end - block.start + 1;
    for(int i = 0 ; i < size ; i++){
        for(int j = 0 ; j < size ; j++){
            printf("%d ", block.start);
        }
        block.start++;
        printf("\n");
    }
}