Print 1 to 10

Print 1 to 10

Welcome to the World of Online Learning:

Hello Friends “This blog helps you to learn C programming concepts. You can learn C language at your own speed and time. One can learn concepts of C language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

Print 1 to 10
Print 1 to 10

Write a C program to Print 1 to 10

PROGRAM: Print 1 to 10

/* Print 1 to 10 using while loop */
#include<stdio.h>
int main()
{
    int i=1;
    while(i <= 10)
    {
        printf("%d\n",i);
        i++;
    }
    return 0;
}

---------------------------------------------

/* Print 1 to 10 using for loop */
#include<stdio.h>
int main()
{
    int i;
    for(i=1;i<=10;i++)
        printf("%d\n",i);
    return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *