I want to write a program where the user can input a number between 1 and 100. The program will then display that number with all numbers preceding it until 1. Each line should have 10 numbers only. So basically it should look like:
I used this code:
#include <stdio.h>
#include <conio.h>
void main(void) {
    int num, counter;
    counter = 1;
    printf("Input a number between 1 and 100: ");
    scanf("%d", &num);
    printf("\n");
    if (num> 1  && num < 100)
        while (num > 0) {
            printf("%d %d %d %d %d %d %d %d %d %d \n", num, num - 1, num - 2, num - 3, num - 4, num - 5, num - 6, num - 7, num - 8, num - 9);
            num -= 10;
        }
    else
        printf("\nInvalid value. Please enter a different number.");
    getch();
}
But at the end, it still keeps on showing 0 and negative numbers. 
How do I fix this?


 
     
    