Generating a Sequence: Exploring Loops in C Programming

#include <stdio.h>
int main()
{
    int num;
    int a;

    // Prompt user to enter the number of digits to print
    printf("How many digits you want to print: \n");
    scanf("%d", &num);

    // Loop to print the specified number of digits
    for (a = 1; num >= a; a++)
    {
        printf("%d \n", a);
    }

    return 0;
}

// Blog Title: "Generating a Sequence: Exploring Loops in C Programming"
// Keywords: C programming, loops, sequence generation, number printing

Comments

Popular posts from this blog

Weird Algorithm || Introductory Problem || CSES